This question is already asked twice but has no answer
Apps installed on Xiaomi devices need a permission called ‘show on lock screen’ in order to allow activity to start if the device is locked
How can I prompt the user to enable this permission programmaticaly in android studio, Some messaging apps like Messenger,Telegram,Whatapp have this permission already enabled
I already added these four flags but the activity is not shown if the permission is not granted
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON|
WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD|
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED|
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
Thanks in advance
2
Answers
Here is the doc that shows How to create a widgets: https://developer.android.com/guide/topics/appwidgets/index.html#lockscreen
you have to create a widget that have a flags that sets to
that help the user to interact on lockscreen
i didn’t find the proper way to request permission but if you want to move manually to the proper settings and allow it, here’s the way. i hope it’s work for you.
EDIT:
for check Permission you can use this line of code and then call the function.