Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to block or hide app access on Android?

Tags:

I want to know from your experience what are the best practices for remotely block/hide Android App?

With iOS you can hide certain (or all) apps with iOS profile and push the profile to iOS using MDM Server (if iOS in supervised mode)

Some people suggest creating an android app that monitors the foreground app and creates an overlay on top of it. do you think about this?

like image 884
AFT Avatar asked Oct 25 '18 05:10

AFT


2 Answers

Let me tell you briefly about this because i did these type of things in past.

We can hide only our app in user mobile,we can't hide other apps in user mobile but we can block any app in user mobile. For this you can use any way either statically or dynamically(via server)

Now the question is how ? So here is the answer

  1. You need to run background and foreground both service. Now detect the app (package). It means you need to detect whether app is in foreground or in background.
  2. So if the app is in foreground then you need to close/block the app.

Now the another question is how we can close/block the app ?

Suppose you want to close/block Facebook app in user mobile then use condition like

   if (packagename.equals("com.facebook.katana"){
            Intent startMain = new Intent(Intent.ACTION_MAIN);
            startMain.addCategory(Intent.CATEGORY_HOME);
            startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(startMain);

    }

You need to use above code in service. Service will detect continuously whether Facebook app is in foreground or not. You can use timer or thread for this.

As soon as the service gets the Facebook Open then service will fire intent to Home Screen.

Above is the best possible way to close/ block the apps.

Thanks!

like image 66
Rahul Arora Avatar answered Oct 12 '22 00:10

Rahul Arora


Do you plan to use it on your own devices? If so, you can create an app that will be started when you boot the device that will control running tasks. And when you detect the app you wish to kill, the service will kill it. You can create remotely configuration about which apps you blacklist using Firebase RemoteConfig functionality. https://firebase.google.com/docs/remote-config/

like image 32
Matej Vukosav Avatar answered Oct 12 '22 01:10

Matej Vukosav