How to enable "Display over other apps" on Redmi A1+ - android

How to enable Display over other apps on Redmi A1+
I have seen a code that could help circumvent the permission for specific apps, but I don't know how to add the code into the manifest.

Related

can't allow USB debugging with xperia XA1

I'm trying to unistall an app system(it's spotify...) without rooting my phone.
I'm new to the concepts related to android and I'm following this tutorial
So I'm on the step 10 where I need to allow USB debugging to my computer
but when i press "ok", there is the following message : "Because an app is obscuring a permissions request, Settings cannot verify your response" and then I can't grant connexion to my pc.
Does someone know what can i do ?
I don't have your phone and I don't know what apps you have installed so I don't know the exact cause, but this most commonly happens when you have an app installed that has the "draw over other apps" setting enabled. Find the app at fault and either delete it or try to turn off the "draw over other apps" setting for the offending application.
What the error message is trying to communicate is that the button to grant permissions for the application can't be clicked because something is covering up the prompt buttons.
I found this problem when there is FB chathead on screen or when I set display overlay, etc But, I don't have XA1. Hope this can help other people.
Reset default settings and turn off the "draw over other apps" setting for none default apps and it should be working.
Settings --> General --> Apps --> Top right dots --> Reset App Preferences.

Doze Mode battery optimization, device specific issue

I implemented ignore battery optimization functionality programmatically.
I found lots of questions and answers but i want to know that the IGNORE_BATTERY_OPTIMIZATIONS is works only for pure android or is there any other cases?
I have couple of devices as below listed :
Moto g4 (7.0)
Moto g play (6.0)
Samsung galaxy note 4(6.0)
Mi note 4 (6.0)
Lenovo Tab(6.0)
Honor (6.0)
It works proper in Moto device.
In Moto we able to get pop up and if we accept permission then it works well.
It work 50% correct in Lenovo tab & Honor devices.
In Lenovo tab when the Permission pop up appears and if we accept the permission then the application added but when we change settings manually it's not working.
Well while in Honor devices when we got permission popup and accept the permission after that we open setting and check the app status its listed in don't allow battery optimization app but the state of the application is "Allow battery optimization". After that when we allow it manually it will work.
In MI and Samsung devices it's not working anymore.
well The Mi Devices are exceptional cases as they have their customized architecture, so we are not concerning MI devices.
for Samsung note 4 there is a special case as below :
After installing app we got the permission pop up and accept the permission. After that we check it in setting, but the app is not listed in "don't allow battery optimization" app list. (Note: When device will reboot the app added in don't allow battery optimization)
Here is Code:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
msPackageName = getPackageName();
moPowerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
Log.i(TAG, "Permission " + moPowerManager.isIgnoringBatteryOptimizations(msPackageName));
if (!moPowerManager.isIgnoringBatteryOptimizations(msPackageName)) {
Intent loIntent = new Intent();
loIntent.setAction(android.provider.Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
loIntent.setData(Uri.parse("package:" + msPackageName));
startActivity(loIntent);
}
}
Please advice for this different behavior. and if there is a solution please let me know that. it's becoming frustrating.

Can't read service messages in Redmi Note 3

Have taken all the necessary permissions for reading SMS in android but app is still not able to detect "service messages" on Redmi Note 3. Is there a special permission in Xiaomi devices to read service messages?
If your phone with API 23 or higher (I think the same should work in lower versions also) goto Settings -> Permissions -> Other Permissions. (be sure that you asked required permissions programmatically if you're targeting API 23 or higher version of Android)
There you can find 2 tabs App and Permissions. Select Permissions tab under that select SMS and MMS option. Now choose your app and Accept/Allow to read Service SMS.
If you're using lower version than 23 use Security app (which is built in app Redmi phones) and there you can find Permissions app for the installed apps.
I am also facing same problem in my Mi Note 3. No apps reading my messages, every time i need to enter OTP.
I think it is good feature from RedMi.
Now I solved this problem with following steps.
Goto Setting->Permissions -> Permissions -> their you select app and accept Read SMS messages

How to move an Android App in Auto Start List of Mi Note3, so it receives Push even app is closed

I am working on an android app and from last 2 weeks i am facing a issue in MI Phones that they don't receive Push Notification when application is in Background State or Inactive State. This is working great in other devices like samsung, micromax etc.
At last i solve it by Moving My application in Auto Start Mode through Device Permission Section
Security -> Permission Section -> Auto Start -> MY_APP -> Mark Toggle to On.
When i follow above steps i found that Facebook and whatsapp are already in AutoStart List, means it is possible to move an android application in AutoStart by code.
So can anybody please help me with some piece of code or Tutorials which i can follow to solve this issue.
You can use cordova-plugin-autostart by enabling autostart after boot
cordova.plugins.autoStart.enable();
If enabled is not called, then by default it will be disabled
cordova.plugins.autoStart.disable();
In the config.xml the following needs to be added
<gap:plugin platform="android" name="cordova-plugin-autostart" version="2.0.1" source="npm"/>
NOTE: Installation to the SD card will prevent the automatic start of your app after the boot
I have same issue with mi 3 but bro its not possible from lollipop and marshmallow cause of security reason. But if your phone is rooted then you can change it to allow.

Do I need android.permission.WRITE_SETTINGS to enable/disable Wifi?

I have a (FOSS) app out there which can, among other features, enable and disable Wifi.
AndroidManifest.xml contains android.permission.CHANGE_WIFI_STATE, unit tests on the emulator pass and the feature works on a real device, a HTC Desire running 2.2.2.
The SDK versions are android:minSdkVersion="7" and android:targetSdkVersion="10", so I can't say about newer releases of Android.
I have received one single crash report:
java.lang.SecurityException: Permission Denial: writing com.android.providers.settings.SettingsProvider
uri content://settings/secure from pid=6191,
uid=10114 requires android.permission.WRITE_SETTINGS
Is android.permission.WRITE_SETTINGS possibly required on recent versions of Android? The reference says the permission exists since API 1, so I'd be surprised why it wasn't on older releases.
The user message is weird, it just says "lies", so I am unsure if I should just follow this report and add android.permission.WRITE_SETTINGS.
Any thoughts?
Cheers,
Torsten
That's weird, cause I needed to check exactly the same issue, so i just wrote a few lines of code doing exactly just that : enable/disable wifi and bluetooth.
My conclusion: you dont need the WRITE_SETTINGS permission to toggle the wifi, nor the bluetooth for that matter.
wifi = access_wifi_state + change_wifi_state
BT = bluetooth + bluetooth_admin
(with 4.2.2)
Check whether you were trying something else too, which may trigger the exception ?

Categories

Resources