ML2 home button

Another consideration is run your application in a "Kiosk mode", this would pin the experience to the screen while running and effectively ignore the home but ton presses.

You have two options to achieve this, one is leverage the JNI directly and implement your own lock task management logic in your app, see here Lock task mode  |  Android Developers and the second option is we do have a developer mode CLI option on device:

To launch apps and add them to the lock task whitelist:
adb shell am start-service -n com.magicleap.locktaskservice/.LockTaskService -e \
  "com.magicleap.locktaskservice.EXTRA_ADD_AND_LAUNCH" "your.package.name"

To remove a package from the task whitelist:

adb shell am start-service -n com.magicleap.locktaskservice/.LockTaskService -e \
  "com.magicleap.locktaskservice.EXTRA_REMOVE_PACKAGE" "your.package.name"

To remove all packages (effectively ending lock task mode) from the task whitelist
(the 'value', 0 below, is ignored)

adb shell am start-service -n com.magicleap.locktaskservice/.LockTaskService -e \
  "com.magicleap.locktaskservice.EXTRA_REMOVE_ALL_PACKAGES" 0

Notice that other activities cannot be started while lock task mode is enabled```

Note the CLI tool is effectively leveraging the app logic one would implement in step 1 and what MDM applications would do.

1 Like