I am creating an android application that uses WindowManager type: TYPE_APLICATION_OVERLAY so it requires this permission in the manifest file:
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
Which already exists in the AndroidManifest.xml.
The problem is that once I launched my app, then go manually to my device's Draw Over Other Apps settings to grant the said permission, my app is not there.
Is there something missing? Or is Draw Over Other Apps settings the correct place to go to grant SYSTEM_ALERT_WINDOW?
My target device is android 11, api level 30.
I've followed exactly this instruction here.
I've tried launching an Intent action Settings.ACTION_MANAGE_OVERLAY_PERMISSION to automatically go the same setting to grant permission but it just go to my device's Draw Over Other Apps settings to which my app is excluded.
Screenshot to Draw Over Other Apps Settings
Related
According to this post, after publishing in Play Store for Android 6 device the SYSTEM_ALERT_WINDOW permission has to be given automatically.
Here it's shown that my App has permission to draw over other apps.
But after downloading from Play Store it is not provided automatically.
I have announced SYSTEM_ALERT_WINDOW only in AndroidManifest.xml
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
What else can I do to make users receive the SYSTEM_ALERT_WINDOW permission automatically after downloading the app from an app store? Is there any chance that the Play Store will block me and not grant the ability to get the permission automatically?
I need to display request permission (Read external storage) at run time. without the permission my app crash instantly.
In API 14 you don't need to do a request.
Just put in your manifest above <application> section:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
Requesting permissions at run time is not supported with API level 14, it isn't supported until API level 23.
If you're running your app from Android Studio on a device or emulator where the app is already installed, your app will not ask for permission when it runs. If you inadvertently remove the permission you will need to manually grant the permission through the Application Manager on the device or emulator.
To prevent the initial crash, you could wrap the offending call in a permissions check.
if (ContextCompat.checkSelfPermission(thisActivity, Manifest.permission.READ_EXTERNAL_STORAGE)
== PackageManager.PERMISSION_GRANTED) {
// READ DATA
}
Hope this helps!
In my app, I need to use android.permission.SYSTEM_ALERT_WINDOW permission. Now I know to go to setting to open it. But some of the application is automatically opened. I want to know how to do it
If i got it right, you want to ask the user for some permissions on app launch. There's a great library to help you do that in Android :
Github link for the Permission dispatcher library
You can also check these libraries :
App-Runtime-Permissions-Android
Assent
MarshmallowPermissionManager
Every app that requests the SYSTEM_ALERT_WINDOW permission and that is installed through the Play Store (version 6.0.5 or higher is required), will have granted the permission automatically.
If instead the app is sideloaded, the permission is not automatically granted. You can try to download and install the Evernote APK from apkmirror.com. As you can see you need to manually grant the permission in Settings -> Apps -> Draw over other apps.
It is a new behaviour introduced in Marshmallow 6.0.1.
If you want the app to be sideloaded, you show manually show a prompt and direct the user to enable Draw over other apps permissions from the settings. Have a look at Requesting permissions
hi i am working in framework side implementing one test app to disable another app but when i run my test app it is showing
Java.lang.SecurityException: Permission Denial: attempt to change component state from pid=xxx,uid=xxxx,package uid=xxx
at xxxxxxxx
my java code
PackageManager pm = getApplicationContext().getPackagemanager();
pm.setComponentEnabledSetting(new ComponentName("com.example","MainActivity"),
PackageManager.COMPONENT_ENABLED_STATE_DISABLED,PackageManager.DONT_KILL_APP);
AndroidManifest.xml
<uses-permission android:name="android.permission.CHANGE_COMPONENT_ENABLED_STATE>
i have tried above permission with both (Permission is only granted to system apps) and also tried tag but no lucky
how to use system apps granted permission,
Could you please guys help me to resolve this issue
Thanks in advance
If you application is not a part of the system partition, then you will not be granted the permission. Get the app into the system partition and confirm that the PackageManager upon parsing your app during the dexopt grants you your desired permission.
You can not Enable/disable app unless your app is system app
My steps are:
Disable package with command: pm disable "packageName"
Enable packageName with command: pm enable packageName
Launch principal activity if you know the name activity principal,
Intent i = new Intent(Intent.ACTION_MAIN);
i.setComponent(new ComponentName("namePackage", "namePackage.MainPrincipal"));
i.addCategory(Intent.CATEGORY_LAUNCHER);
startActivity(i);
If your device is rooted, you can install your app as a system app by simply copying the apk into /system/app (/system/priv-app for 4.4+). This will allow you to use the "system only" permissions.
How would you access the security system settings eg airplane mode.. from android studio. I can do it through adb but I'd prefer to do it through android studio in my application. I tried writing code that gives the user an option to select 'modify system settings options' to give full access but it still keeps telling Permission denial: writing to settings requires:android.permission.WRITE_SECURE_SETTINGS, most of the answers are a bit old so it would be nice if someone directed me to a path
All permissions that your app wants to use (INTERNET,BLUETOOTH, etc) must be defined on the Manifest.XML file like this:
<uses-permission android:name="permission here"/>
Spesifically the WRITE_SECURE_SETTINGS permission's protection level is "signature" (more on that here) and that means that permission is only granted to systems apps. So to "fix" your Permission denial error you need to add this permission into the Manifest.XML file, but this is redundant because it wont let you USE that permission due to its protection level.