How can I customize permission dialog in Android?

The short answer is, you can’t. As android documentation puts: When your app calls requestPermissions(), the system shows a standard dialog box to the user. Your app cannot configure or alter that dialog box. If you need to provide any information or explanation to the user, you should do that before you call requestPermissions(), as … Read more

NameNotFoundException when calling getPackageInfo on Android 11

As stated in https://developer.android.com/preview/privacy/package-visibility: Android 11 changes how apps can query and interact with other apps that the user has installed on a device. Using the new element, apps can define the set of other apps that they can access. This element helps encourage the principle of least privilege by telling the system which other … Read more

Read logs from all apps on android from within an app for android 4.2+

Unless you rooted you cannot do this since Jelly Bean. See this Android bug report and this related discussion. Quote: The change is that third party applications can no longer get the read logs permission, however every app can read the logs containing only the lines they have written, without needing any permission. Keep in … Read more

Boot BroadcastReceiver does not work on Xiaomi devices

I searched around the web and found a solution, I’ve decided to answer my own question. Follow the same code given in the question. In Xiaomi devices, you just have to add your app to Autostart list, to do so, follow these simple steps given below: Open Security app on your phone. Tap on Permissions, … Read more

Permission denied on writing to external storage despite permission

UPDATE: See Volker Voecking’s answer for a better solution EDIT: This is simply a workaround for those who don’t have time to look for a solution. * If you get permission denied error even when the permissions are granted and you already implemented permission checks, make sure you’re not targetting api level 29: Change targetSdkVersion … Read more

Signing my android application as system app

Answering your three questions: 1 – Where do I get these signature key? From Android’s own documentation in the section Release Keys The Android tree includes test-keys under build/target/product/security But the next part is where you should really pay attention Since the test-keys are publicly known, anybody can sign their own .apk files with the … Read more

How to detect Bluetooth state change using a broadcast receiver?

AS far as permissions go, to detect the state change of bluetooth you need to add this to your AndroidManifest.xml. <uses-permission android:name=”android.permission.BLUETOOTH” /> An example receiver would look like this, you add this code to where you want to handle the broadcast, for example an activity: private final BroadcastReceiver mReceiver = new BroadcastReceiver() { public … Read more

WRITE_EXTERNAL_STORAGE when targeting Android 10

A workaround is to actually ignore the warning, as it is just informational and therefore harmless. By setting maxSdkVersion to 28 no need to worry anymore. <uses-permission android:name=”android.permission.WRITE_EXTERNAL_STORAGE” android:maxSdkVersion=”28″ tools:ignore=”ScopedStorage” /> Note that using the android:requestLegacyExternalStorage flag as stated in other answers is not a solution, is just a temporary patch which will no longer … Read more

Android : Permissions check for BLE [closed]

Google made Android more strict by adding the new BLUETOOTH_CONNECT and BLUETOOTH_SCAN permissions. You will get SecurityException in runtime if you attempt to access any BLE API that requires these permissions. So we need to check the permissions in the activity which is set to android.intent.action.MAIN in the manifest file. I call that as MainActivity. … Read more

Why does play-services-location need the android.permission.WRITE_EXTERNAL_STORAGE and android.permission.READ_EXTERNAL_STORAGE permissions?

Short answer: I don’t believe play-services-location does need those permissions. Neither does it seem to need android.permission.ACCESS_NETWORK_STATE or android.permission.INTERNET, which are also being added. Longer answer: Looking at my manifest merger log, it appears that all four of these permissions are being included at the request of play-services-maps, which -location is linking in of its … Read more