Ignore battery optimization permission for our android app is getting denied on Xiaomi android 11 devices - android-11

In our android app we ask for ignore battery optimization permission, and the user has an option to allow or deny the permission
On some Xiaomi android 11 devices , even when the user clicks allow permission , it brings back an error that the permission couldn't be set.
But when the user manually searches for Battery Optimization setting and selects dont optimise , and retries granting it through our app , the permission for ignoring battery optimization is granted
We are not able to grant ignore battery optimization permission on Xiaomi devices programmatically when we follow the android standard by using ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS to white list our app
On other devices users are able to grant the permission through our app
I am not sure if there is any bug from MIUI on android 11 devices that doesn't allow apps to stop battery optimization
Can anyone suggest a workaround on how do we programmatically disable battery optimization on xiaomi devices running on android 11 ?

Your user need to allow manually your app to be executed in background and open automatically when needed from setting->app->
Allow automatic startup to on
Change energy save MIUI to No restrictions
Unfortunately there's no way to go around this problem...

Related

Modifying / Setting / revoking permissions of Android application (system? )via adb, android 11 (miui 12.5 eu)

I'm a Basic Newbie trying to make changes on my phone ;-) maybe you can help me.
I'm trying to limit the amount of data I share with Xiaomi & google while using a xiaomi phone.
Since the unfortunate update to miui 12.5 I cannot define the permissions I want using Setting=> Apps=> Manage apps => permissions.
For example:
Miui Bluetooth ¦ location permission : preselected "Allow only while using the app". I cannot change this! All options are grey!
I also have an issue when I try to limit the data access. Specially the background data, and WIFI.
I am hoping to be able to make some changes over adb, but I've no idea how... just managed to see the permissions for each app.
The phone is not rooted, and the stupid xiaomi unlock... doesn't work (your device is not recognized when I connect it over USB).
Thanks for your help!
(please explain things as if you'd try to explain it to your Granma :-))

Xamarin auto permissions grantee without permission dialog

When we download Whatsapp, it automatically guarantees the permissions itself without showing us the permission dialog. How can I do this in Xamarin? my platform is Android.
Perhaps if your device is rooted this could be possible. Otherwise, the answer is no.
Ever since API 23 (Android 6 Marshmallow), App permissions have been a thing. If your App targets API 23 or higher, this is something you have to support and ask for whenever you do something that is marked "dangerous". These are permissions for stuff that could involve personal information about the user of the device. You can read more about permission levels in the official Android docs.

Can we detect ibeacons through android phones without explicitly turning on the bluetooth or location?

How can we detect ibeacons from a android phone without explicitly switching on the bluetooth or location...?
I want to design an app which detects for the beacon even when the bluetooth is off...please suggest the answer
Sorry, this is not possible. Bluetooth must be turned on to detect t beacons as it requires using the Bluetooth radio to do a scan.
With BLUETOOTH_ADMIN permission (required for scanning anyway), it is possible to detect if bluetooth is off, then turn it on long enough to do a scan, then turn it back off again. The user will see the Bluetooth icon when this happens, and the user will be told at install time that the app requires this permission.

Android Wear System Alert Window Permission

How to ask for system alert window permission on Android Wear? I am able to achieve the SYSTEM ALERT WINDOW for mobile but on the wearable device same code is not working for me. If any example of SYSTEM ALERT WINDOW for wearable would help me a lot.
This is a duplicate of Requesting permissions on Android wear, but SO won't let me mark it as such because the OP didn't accept my answer there.
The summary is that it's not possible to request this permission on Android Wear 1.x, but it is on Wear 2 (currently in beta and slated for release in early 2017).
In addition to #String's answer, you might want to use requestPermissions() method. Please note, these permissions must be requested in your manifest.
And, as mentioned in Permissions for Services,
only an activity can call the requestPermissions() method, so if the user interacts with your app via a service, for example a watch face, the service must open a background activity before requesting the permission.
You can gain additional insights from the solutions given in this SO post and from the sample code shown in this GitHub post.

How do you test for permissions?

Is there a way to simulate whether permission are granted or denied to use services like location on the Windows Phone 7? I want to get the users current location, but I can't seem to find away to make the phone show me the permissions dialog so that I can deny access to it for testing? Anyone else have these kinds of issues? I'm finding it rather hard to really test this stuff without having the actual hardware.
I can't seem to find any built-in support to check if the user will allow the location & push notification services to be used within an application.
I would expect a location-aware Windows Phone 7 app to present a dialog box to the user informing that location services will be used within the app. The dialog box has a "Allow" and a "Deny" option. Based on the selection of the user, the app may or may not use the location of the user. I have used Shawn Wildermuth's Child Window to evaluate the user's choice and use their decision in their application accordingly.
HTH,
indyfromoz
You don't need to check for permissions. When app is certified, AppHub scans application for code requiring permissions and updates WMAppManifest.xml.
When user installs your app, he agrees on all permissions you need. So if it's launched, then you got all you need.

Resources