Android stops closing the application

Is there a way to create a custom MDM so that the application is always open. ie do not let the user close.

I am creating an image gallery application that will be displayed to users. but I don’t want them to be able to close my application.

thanks

something like that?

public class IntentReceiver extends BroadcastReceiver { public static final String TAG = IntentReceiver.class.getSimpleName(); @Override public void onReceive(Context context, Intent intent) { Log.i(TAG, "onReceive - intent => " + intent.getAction()); //Get Intent String action = intent.getAction(); if("android.intent.category.HOME".equals(action)) { Intent i = new Intent(); i.setClass(context, MainActivity.class); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(i); } 

But then I also need to know when the application is closed or killed?

Let me try to explain better. Imagine if an artist wants to show his work through 10 Android devices. everything is in the wall. Therefore, he can use this application. I want to lock the device. just to run this application and nothing else to work. A similar calculator when you go to the phone store and the demo application is running on the entire device, and you cannot exit it with a password. (i.e. Apple Store) you cannot exit the application running on these ipads

+4
source share
3 answers

I wrote a message specifically in the kiosk mode on Android - it was just "setting the task."

http://www.sureshjoshi.com/mobile/android-kiosk-mode-without-root/

  • Create a DeviceAdminReceiver and put it in your manifest
  • Then run dpm to access the admin device.

adb shell dpm set-device-owner com.sureshjoshi.android.kioskexample / .AdminReceiver

  • Make sure you own the device in the app and you go racing.

There is a lot of work to do this, however, once you make the template, you end up using this snippet to enable and disable.

 private void enableKioskMode(boolean enabled) { try { if (enabled) { if (mDpm.isLockTaskPermitted(this.getPackageName())) { startLockTask(); mIsKioskEnabled = true; mButton.setText(getString(R.string.exit_kiosk_mode)); } else { Toast.makeText(this, getString(R.string.kiosk_not_permitted), Toast.LENGTH_SHORT).show(); } } else { stopLockTask(); mIsKioskEnabled = false; mButton.setText(getString(R.string.enter_kiosk_mode)); } } catch (Exception e) { // TODO: Log and handle appropriately } } 
+1
source

In these scenarios, do not reinvent the wheel, but install Android 5.0 or later and use the aka kiosk mode assignment

0
source

As stated in @Sarge from 5.0, kiosk mode is available. If you don’t work in version 5.0, let me know and I worked a little to search my old project and give you the Kiosk home mode (no need to blink a tablet or anything else, just program)

0
source

All Articles