Issue
I have an application that opens an Activity on a certain event.
Just like alarm application. I use the following flags:
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
| WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
| WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
| WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
| WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON
);
The application creates a wake lock for that purpose.
On most devices it works fine, but on Xiaomi Redme 2(Android 6) it does not.
When the application launches the Activity, the screen is turned on and the lock screen displayed. My Activity is NOT displayed.
After I enter password I see my Activity.
Then I have changed the package name, and Activity displayed successfully without a lock screen.
It looks as though Xiaomi has black listed our original app for some reason.
I wonder if anyone has encountered this behavior and has a solution?
Solution
This is a Xiaomi/MIUI specific issue. You need to grant special permission to an app to unlock the screen during alarm.
Go to System Settings > Permissions > Advanced Permissions > select the app and give it permission to access Lockscreen.
Source https://sleep.urbandroid.org/faqs/?Display_FAQ=22281
Answered By - Pavel
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.