Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to be notified when screen pinning is turned off in Android 5.0 Lollipop?

I have an app that runs in the background and starts an activity when a certain event occurs on the phone. I'm finding with Android 5.0 that when the user has screen pinning turned on with another app, the startActivity(intent) call is ignored completely. My app doesn't know that the activity didn't start, so the user then won't have another chance to see the activity until they manually reopen my app.

Is there any sort of event I can register for to be notified when screen pinning is turned off, so I can reattempt to start my activity?

like image 926
jokeefe Avatar asked Aug 31 '25 18:08

jokeefe


1 Answers

Here is method in ActivityManager class which tells status of current task if locked or not in case of screen pinning:

!mActivityManager.isInLockTaskMode()

For more details check this link: http://developer.android.com/reference/android/app/ActivityManager.html#isInLockTaskMode%28%29

like image 97
Vikasdeep Singh Avatar answered Sep 02 '25 09:09

Vikasdeep Singh