exec("su") permission denied? - android

when I use this code
Runtime.getRuntime().exec("su").
and listen to the ErrorStream it gives me back: Permission denied. However SuperUser successfully grants permissions. Any Ideas?

You need to add to your AndroidManifest.xml
<uses-permission android:name="android.permission.ACCESS_SUPERUSER"/>

My ROM was messed up. I had to reinstall it. Adding a permission should NOT help.
Edit: SuperUser is now giving warning if you don't define the permission, how ever it will still grant su.

Related

ANSWER_PHONE_CALLS permission granted Issue

Android devs.
I have a critical issue to grant the permissions.
I am developing an app to use so many permissions, but my customer doesn't like the permission dialogs for each permission. So I decrease the target SDK version to 22 to avoid the disturbing permission dialog. But I noticed a critical issue with ANSWER_PHONE_CALLS permission. I have googled and got that when the SDK version is lower than 23, there is no need to consider the permission on runtime, but just add the permission in the AndroidManifest file. But actually, when I get the return value of checkSelfPermission for ANDROID_PHONE_CALLS permission, it returns -1(denied). And some features using this permission are all failed with not permitted. Is there anyone who has experienced this, and let me know how to control this issue? Thanks! (I really hope to find the solution.) :(

Can Android normal level permissions be requested at installation time (in the manifest)?

In later versions of Android (like 8.0.0), can we still declare normal level permissions in the manifest, like INTERNET permission and expect it to be granted at installation time?
<uses-permission android:name="android.permission.INTERNET" />
or do we need to explicitly request them through the code?
If the second, do we need to ask for it on every single activity?
can we still declare normal level permissions in the manifest, like INTERNET permission and expect it to be granted at installation time?
Yes. Only dangerous ones need to be requested at runtime.
Yes, you can declare normal level permissions in the manifest. But in 6.0 and above you have to check that permission is granted or not by user at runtime.

How to request permission on Android Things?

I'm trying to write to a value on AT. I've already declared required permission as follow in manifest,
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>
And try to request permission at run-time, AT shows windows regarding permission setup. However the switch is not clickable. Regarding AT document
Requesting Permissions at Runtime is not supported because embedded
devices aren't guaranteed to have a UI to accept the runtime dialog.
Declare permissions that you need in your app's manifest file. All
normal and dangerous permissions declared in your app's manifest are
granted at install time.
However Settings.System.canWrite() always returns false.
Are there any special methods to enable permission WRITE_SETTINGS?
Like you said, the documents say:
Declare permissions that you need in your app's manifest file. All normal and dangerous permissions declared in your app's manifest are granted at install time.
Therefore you don't see the normal Android permissions UI.
From the release notes:
Dangerous permissions requested by apps are not granted until the next device reboot. This includes new app installs and new elements in existing apps.
So try powering off and on your Android Things device
After install application with the statement on AndroidManifest.xml as follow
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>
It needs to be also run Settings as follow via adb
adb shell am start -S com.android.settings/.Settings
Then click APPS>YOUR_APP, then click permission.
Now the switch is clickable. So AT not granted to permission. It needs to be granted manually.
This permission is having Protection level: signature.Which means this permission is only granted to system apps.
Please find the below screenshot for your reference :

Android - Access PROCESS_INCOMING_CALLS permission programmatically

There's no permission in Manifest class for the android.permission.PROCESS_INCOMING_CALLS permission. I need it for runtime asking for permissions.
There's no permission in Manifest class for the android.permission.PROCESS_INCOMING_CALLS permission.
That is because Android does not have such a permission, as you can tell by looking at Android's own manifest and looking at the various <permission> elements.

android.permission.MODIFY_PHONE_STATE" not worked properly

I had already added this permission in my Manifest
<uses-permission android:name="android.permission.MODIFY_PHONE_STATE" />
But it will not give me permission to cut the incoming call, I can receive the call.when I'm try to cut the call it give me
java.lang.SecurityException: Neither user 10037 nor current process has android.permission.MODIFY_PHONE_STATE.
I have gone through so many blogs,but none of work.
In some of the emulator its working fine.
MODIFY_PHONE_STATE is a system-only permission, so you can not access or use this permission in your app,
Check it out!
Place your app in the /system/priv-app folder instead of /system/app, when using Android 4.3 or higher.

Categories

Resources