I am working on a Locker kind of app. My requirement is to open up a password screen when user goes to start specific applications (which are selected by user previously in my application.) I show the user a list of all applications with a Toggle button to lock / unlock. I am saving the preferences of the user in local sqlite database.
Main issue is how to get notified when the user starts one of those applications.
I went through this, this, this, this and many other vague posts already.
So now, we need system privileges for all 3 of these permissions:
<uses-permission android:name="android.permission.GET_TOP_ACTIVITY_INFO"/>
<uses-permission
android:name="android.permission.PACKAGE_USAGE_STATS"
tools:ignore="ProtectedPermissions" />
<uses-permission android:name="android.permission.READ_LOGS"/>
I cannot make my app system app. It should behave as a normal user app. So this option is not useful.
The question is: Is there any other option to do this without rooted device / system privileged application? If so, please provide me a few guidelines I can follow.