0

I'm currently working on a project that is going to have over 100 android devices used and the users of each device will also change on a daily bases.

What we want to achieve is that the user is allowed to open only 1 or 2 of the apps on the device. Meanwhile, everything else should be forbidden.

I've seen that G suite offers app whitelisting, but that doesn't really seem like the right use case and also it would cost more than 500$ a month to maintain. Also, the apps that will be on those devices will not be published on play store and will be directly installed via apk.

Thanks in advance!

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115

1 Answers1

-1

Have you checked UserStatsManager class, you need to check which application is foreground and then you can display your own activity if it's not the intended one.

Anuj Sharma
  • 498
  • 3
  • 20
  • This does not sound like a particularly secure or efficient solution. – greeble31 Jan 24 '20 at 17:39
  • @greeble31 as far as I know another way is to use - ActivityManager.RunningAppProcessInfo in a background service to check the target application. Do you have a different view, can you please elaborate. Reference link - https://stackoverflow.com/questions/3290936/android-detect-when-other-apps-are-launched – Anuj Sharma Jan 26 '20 at 17:03
  • Consider the security implications. If you were the OS, would you want to allow some random user-mode app to start controlling access to other user-mode apps? What if you managed to block the phone app, while someone was needing to call emergency services? Google cannot allow that; they could be held liable. Consider how you'd need to use `UserStatsManager`. It doesn't tell you which app is in the foreground; you have to poll it. What interval do you use? Every second? That means a user can access a forbidden app for almost an entire second. Less? Then you're burning up your CPU, polling. – greeble31 Jan 26 '20 at 20:05
  • That's why solutions like this are problematic. You need OS/kernel-level support to do something like this. I understand your solution is based on another question with an accepted answer, and I do not wish to offend you, but everything in that question is just wrong, bad, insecure, and (I'm fairly certain) Android won't allow any of it on a modern device. You may wish to examine the URL I gave to the OP in the comments. – greeble31 Jan 26 '20 at 20:08
  • @greeble31 then how do you think application like app lock are working? If google were not allowing them, how they are allowing them to publish it on play store as well? Reference app - https://www.google.com/search?q=app+lock+play+store&oq=app+lock+play+store&aqs=chrome.0.0l8.3481j0j1&sourceid=chrome&ie=UTF-8 I agree these solutions can be problematic if and only if they are not handled properly unlike the many applications that are alredy published on the play store. – Anuj Sharma Jan 28 '20 at 12:03
  • I do not know; I have not researched those apps. All I know is that solutions based on `UserStatsManager` cannot be 1.) secure or 2.) efficient. – greeble31 Jan 28 '20 at 14:08