I am talking about the quality issue (bug) that an Android app needs a permission that is declared in the Manifest, but fails to request it from the user at the appropriate time and executes the code without the necessary permission. This was not possible in older Android versions (user accepts all permissions in bulk), but seems to be possible when using newer versions that copy Apple in most regards.
At least during testing one can start background services and use bluetooth without any alert by Google popping up. Is that different for apps in production?
Does the app crash with an Exception?
Does the code get executed?
Does the app get rejected in review? (Always?)
Does the app get delisted from the store?
Does it depend on Android's Version?
I deal with an age old app that has bluetooth discovery code to find and connect to dedicated hardware, that is rarely used via a cordova plugin triggered by content. There is old altbeacon code potentially activated that may even need access background location (https://developer.android.com/guide/topics/connectivity/bluetooth#Permissions). It will take some time to get this dead code up to quality. Definitely more time than the week we have.
Does the app crash with an Exception?
yes if you try to have operations depends on returned date witch is null
Does the code get executed?
code will execute with exceptions because data access denied you can check if permission granted or not and add scenario for each state
Does the app get rejected in review? (Always?) not sure but with crashes there is high potential to get rejected
Does the app get delisted from the store?
depends on why and how you are using data
Does it depend on Android's Version?
yes access data and permissions changing point is android oreo
My tests with Bluetooth permissions revealed the following: Required permissions are BLUETOOTH_ADMIN, BLUETOOTH and for VERSION_CODES.Q additionally Manifest.permission.ACCESS_BACKGROUND_LOCATION (see: https://developer.android.com/guide/topics/connectivity/bluetooth#Permissions).
BLUETOOTH_ADMIN, BLUETOOTH do not show any system alert-dialogue to the user. In Android Q+ if you fail to check for the required ACCESS_BACKGROUND_LOCATION permission, nothing happens and your code executes without exception (mine did execute an UART command on hardware with Samsung tablet). The app passed review although the check is missing (of course I will fix that ASAP).
Note: the doc is ambiguous and states: "Services running on Android 10 and higher cannot discover Bluetooth devices unless they have the ACCESS_BACKGROUND_LOCATION permission." Probably general scanning while the app is active could be allowed. In that case missing exception would be explained.
We develop an application which requires several permissions in order to get the user’s location while in the background.
We are having problems requesting the required permissions on Xiaomi devices. It seems that in addition to location permission and white listing the app from battery optimizations, two additional steps are required, specific to Xiaomi devices:
Disabling battery saver:
Enabling auto-start:
The problem is we found no way of automatically requesting permission from the user, and the only way we found is having the user manually go to these screens and change the settings.
We did find shortcuts to take us “half way”.
Going to power settings:
Intent intent = new
Intent("miui.intent.action.POWER_HIDE_MODE_APP_LIST").addCategory(Intent.CATEGORY_DEFAULT);
Going to auto start settings:
Intent intent = new
Intent("miui.intent.action.OP_AUTO_START").addCategory(Intent.CATEGORY_DEFAULT);
But multiple non intuitive actions are still required from the user.
Our aim:
We would very much like to make the process easier for the user. Optimally, to have a system dialog appear which asks the user for the permissions, instead of having him manually change the settings, much like the whitelisting of normal Android devices:
Is it possible using a Xiaomi specific SDK extension?
If (1) is not possible, at the very least we need a way to know if the user changes these settings or not. Currently we don’t know and cannot inform the user if the application works properly or not!
I have an APP to end call automaticly using ITelephony.aidl. It works on almost every devices except Samsung J6. When I try to finish the call, the exception will be thrown casued of Modify_phone_state permissin.
If it works, consider yourself lucky. Google has been removing ways of programmatically ending calls for years, almost as quickly as they pop up. Its not functionality they want us to have. If you do have a new way, expect it to be removed.
Samsung's behavior is actually correct. You aren't supposed to be able to end a call unless you have that permission, which is a system privlidged permission not available to apps without being pre-installed or rooting.
I have the following problem:
My app is distributed over an MDM system and runs in Android for Work.
In certain situation, the app must temporarily terminate the DnD mode. To achieve this, the user must grant the DnD permission when the app is started.
So far so good. If I install the app in the unmanaged area, the app shows up in the list and the permission can be granted without any problems.
As soon as the app is distributed via an MDM system, the app no longer appears in the list and the permission cannot be granted. All authorizations have been granted in the MDM system. As an example, I have distributed the Google App over the MDM system. This app appears in the list.
In the Manifest I have set the following permission:
<uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY" />
When the app is started, the following code is executed:
NotificationManager nm = (NotificationManager).getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE);
if(android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M && !nm.isNotificationPolicyAccessGranted()) {
Intent intent = new
Intent(Settings.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS);
startActivity(intent);
}
The problem only occurs with DnD permission. All other permissions such as overlay permission, are displayed without problems.
I hope anyone can help me.
According to Android documentation: NOT POSSIBLE
Users can grant and deny access to Do Not Disturb configuration from here. Managed profiles cannot grant Do Not Disturb access.
I haven't found a proper solution for the problem yet but I found a workaround to display the app in the work area. It seems that the app is only displayed in the dialog if the same app is also installed in the private area.
If the app is not installed in the private area, it will also not appear in the work area.
My workaround was to install the app in the private and work area. After the permission in the work area was granted, I removed the app from the private area. Like I said, it's not a solution to the problem itself, but it worked.
To me this looks like a bug in Android, because for all other permissions the app appears in the list
Apparently there is issure reported regarding this on Google Issue Tracker
https://issuetracker.google.com/issues/77939714
This is the reply from Google:
Status: Won't Fix (Intended Behavior) 11:41AM You can not change DND
settings from a managed profile app. We will be updating the
documentation to clarify this.
There is also a reply stating:
Microsoft Intune has released their fully managed Android Enterprise
profile setup for Android Devices. ... and it can now access and
grant the DnD permission. Not sure if its the fact that we have gone
to fully managed devices or if something else has changed.
And I would believe this is actually because the device is fully managed.
So according to my understadning there are two options:
Fully managed device (will require a factory reset on the phone)
Install it on the personal profile
We have the same issue with the app SignOnSite. Can't get access to the DnD function for emergency evacuations unless we also install the app in the Personal space as well. Makes it to risky doing it this way, so ended up just installing the app in the Personal space.
Using Intune for our MDM.
Try this -
Intent intent = new Intent("android.settings.NOTIFICATION_POLICY_ACCESS_SETTINGS");
startActivity(intent);
I have Android Marshmallow on a Nexus 6. I am trying to fix the following problem:
If a user is trying to grant permission while a notification is showing, a "Screen overlay detected" message gets displayed and the Request Permission dialog disappears - of course the app does not get the requested permission. (Check screenshot)
I tried to fix the problem by adding "DRAW OVER OTHER APPS" permission - android.permission.SYSTEM_ALERT_WINDOW to the manifest but with no luck.
PS: I am sure the problem is caused by the notification. I do not have any app installed that overlays over other apps, I even turned off all apps with "Draw over other apps" permission in the settings. Did not help..
Anyone knows a solution to that problem?
In the circumstance that I ran across, I was causing the problem myself. It was the result of using a Toast to display information to the user at the same time that I was asking for permission. Both of these actions together cause this type of error.
The other answers might resolve someone else's issue. But I wanted to note that you should be cautious of causing your own overlays errors. Be careful of overlaying something in the view while simultaneously asking for permission.
Uninstall Clean Master app. I uninstalled it and problem solved
This problem appear because of some culprit application like Twilight, cleaner-master, drupe etc..
To solve this problem you have to disable screen overlay for those culprit apps.
i have moto g4 plus, and this is how i solve this problem
Go to Setting --> Select Apps ---> again select setting icon in Apps ---> select draw over other apps ---> and disable culprit apps who trouble for other apps.
what i done is checking each apps by disabling this permission and try to run my app, and i found one app this troubling overlay for other apps, so at the end i disabled only this app.
ScreenShots:
Got insights from multiple answers here and other forums .
Consolidating how I got rid of the issue :
Go to Settings > Apps > (your app which is getting issue)
Press on Power button till window for Power off , reboot , airplane mode comes up
Hold on Power off option
Select reboot in Safe mode
Go to settings > apps > (your app which is getting issue)
Select whichever permissions you want
After Android M update , issues can come up in apps like Messenger , Whatsapp , Prisma etc.
Let me know if any issues .
Note : I am having One plus One mobile.
This popup is caused by the manifest.PERMISSION.SYSTEM_ALERT_WINDOW permission declared by the manifest.
The are 3 categories of permissions, that developer must be aware of :
Normal permission - do nothing with them, just declare in the Manifest
Vulnerable permissions - declare in Manifest and ask for permission at first time. They can be changed through system settings.
Above dangerous permissions: SYSTEM_ALERT_WINDOW and WRITE_SETTINGS belong to this category. They must be granted, but are not visible in system settings. To request for it you don't use a standard way (int checkSelfPermission (String permission)) but you have to check Settings.canDrawOverlays() or Settings.System.canWrite() appropriately and if you not do that you will get exception like
Unable to add window android.view.ViewRootImpl$W#1de28ad -- permission denied for this window type
1-Request this permission by yourself in your code just like given below:
public class MainActivity extends AppCompatActivity {
public final static int REQUEST_CODE = 10000;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (checkDrawOverlayPermission()) {
Toast.makeText(this, "Permission granted", Toast.LENGTH_SHORT).show();
}
}
public boolean checkDrawOverlayPermission() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
return true;
}
if (!Settings.canDrawOverlays(this)) {
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
Uri.parse("package:" + getPackageName()));
startActivityForResult(intent, REQUEST_CODE);
return false;
} else {
return true;
}
}
#Override
#TargetApi(Build.VERSION_CODES.M)
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_CODE) {
if (Settings.canDrawOverlays(this)) {
Toast.makeText(this, "Permission granted", Toast.LENGTH_SHORT).show();
}
}
}
I just deleted my app and turned off my Nexus 6P. After turning it back on, I reinstalled the app and no longer got the "screen overlay" dialogs when giving the app permissions.
You must disable the overlay for all the apps you see in the list. Only this way can you modify authorizations in the app you need.
I've done that in safe mode, and it worked.
At the end I rebooted the phone and now it is working fine.
I updated my Sony Xperia Z3 (Dual Sim) to Android 6.0.1 (Marsmallow). I have been having screen overlay issues. For me i do not have Clean Master, Du Speed, or Du Booster(as the solutions i have read).
So i solved mine looking for any screen overlay apps.
A screen overlap app, is an app that you can use to access other apps on your main home screen without leaving your home screen. So for me the Screen Overlay App here in my situation was the OMNI SWIPE. So if you are facing this problem you need to calm down and check which of your app fits the definition of a screen overlay app.
locate the app and uninstall then restart your phone ..
i just finished doing this and am having a good time with the phone
Best of Luck
As long as Android 6.x is buggy on some devices where this "overlay alert" is displayed without any reason (on 2 to 5% of the devices according to my analytics data), the best solution is to avoid the whole permission process by defining the targetSdk to 22.
Take care that you can't downgrade the target sdk for a new version or this will induce a INSTALL_FAILED_PERMISSION_DOWNGRADE error when the user updates requiring an unisntall/install of the app.
solution is
remove Toast messages from onRequestPermissionsResult method
This happens when you have granted overlay permission to malicious apps. Go to overlay settings and disable the overlay feature on all apps that don't belong to google and you will be good to go.
I got this problem when installing a new app.
The way I got around this problem is to manually enable the permissions for the newly installed app (before running the app).
I’m pretty sure this is a problem with Android and Samsung devices in particular.
Hope this helps
Delete the apps which have screen overlay like CM security, Clean Master, etc.
Even delete and try with Messenger (FB app) if needed.