Is there a way to get the android lockscreen package name?
I want to show alert on the lockscreen using AlertDialog.Builder
. So I need to know when the lockscreen is active and what it's package name.
Is there a way to get the android lockscreen package name?
I want to show alert on the lockscreen using AlertDialog.Builder
. So I need to know when the lockscreen is active and what it's package name.
Really a Simple solution.
You can detect if the lockscreen is shown with:
And you can get the current top activity with:
This will usually be the lockscreen activity, but it is possible that for example the phone app is shown while the lockscreen is active: in this case it will be the phone activity.
You will need the android.permission.GET_TASKS permission for this to work.
Found a native solution. After you build the Alert dialog and before showing it, apply this:
This will show the dialog on top of the lock screen.