Autostart one app after the device is started

Hi Leapers,

is there a way to autostart the client's app after the client just press the power button on the device?
Imagine 10 spectators, a single presentation and -
everybody has to configure each controller for the device, scroll through the main menu, select the
specific app, start the app, ...

As the app is hand based on handtracking we wouldn't need a controller at all - just a way to autostart :slight_smile:

@pepone assuming you don't want to implement Lock task mode yourself in your application / make your device managed by an MDM app we have a CLI service I referenced here.

You will need one of the more recent release builds to use the service above but it would allow you to set an application into an auto-start fashion that you described. I would strongly suggest trying this first.

If you still want to implement this in your app programmatically then the two approaches I would suggest is implementing Lock Task Mode in your application or making your app a custom Android launcher. These two options can introduce a lot of added complexity to your application if you choose to pursue them (you are basically turning your app into an MDM provider!)

Thanks for the reply. Using

"adb shell am start-service -n com.magicleap.locktaskservice/.LockTaskService -e "com.magicleap.locktaskservice.EXTRA_ADD_AND_LAUNCH" "com.myclient.xr"

gives me "adb.exe: more than one device/emulator".
Any idea how I can address my my device only?
"adb devices" gives me: >> List of devices attached
G862XTXXXX device
192.168.178.XX:5555 device

@pepone you'll need to disable ADB over wifi or unplug the device, looks like you are connect physically and over wifi in the HUB.

Next one:
Starting service: Intent { cmp=com.magicleap.locktaskservice/.LockTaskService (has extras) }
Error: Requires permission not exported from uid 10056

Do I need a special permission to do apply the change?

What System Build version are you on? There was a bug in a previous release and I want to exclude that as an issue. 1.4.0 dev 2 should work though.

1.4.0 dev2 brings me one step further...

entering ...EXTRA_ADD_AND_LAUNCH" "com.xxx.xr"
Consle-Result: Starting service: Intent { cmp=com.magicleap.locktaskservice/.LockTaskService (has extras) }

But if I restart the magic leap nothing happens yet, just the main menu comes up

Did you run the following commands before? You need to set the service as the device owner. I briefly tried this myself and was able to get a small sample locked in.