ML2 home button

Hi, I was wondering if there was a way to disable a home button, when my application is open and running. I would like to remove the feature to pause the app and go to menu, and only allow the option to quit the application instead. Is that possible at all?

I'm using Unity version 2022.2.6f, and the latest ML2 OS and SDK version, on Windows.

Hi @downsideupface, Thanks for reaching out and welcome to the Magic Leap 2 forum. No unfortunately the home button cannot be disabled at this time.

Hi, and thanks for your reply!

Now, I'm wondering, is there a way to perhaps change the home button from a regular press of the button, to a long press? I'm just looking to achieve no accidental home button clicks for the less tech savvy audience. :slight_smile:

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" ""

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" ""

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

Super important but I left out that for the CLI tool to run commands (after putting yourself in developer mode) you need to set receiver must be set it as the device owner (emulates MDM):
adb shell dpm set-device-owner com.magicleap.locktaskservice/.LockTaskAdminReceiver

and to disable the management..

adb shell dpm remove-active-admin com.magicleap.locktaskservice/.LockTaskAdminReceiver