Unity developers can use intents inside their applications to open external activities and services. For example, you can use Intents to open the Eye Calibration application after detecting poor accuracy when using the Eye Tracking feature, or if you want the user to localize into a map before loading the content from your application. This section provides examples of how to call both implicit and explicit intents.
Magic Leap also includes an API to open Magic Leap System Settings from inside your application. The
UnityEngine.XR.MagicLeap.SettingsIntentsLauncher is pre-configured to allow developers to open the device's Display Settings, Voice Input settings, and AR Cloud Settings using a single line of code. Additional intents can be launched by passing the Intent Action ID.
Launching pre-defined intents:
Launching custom intents:
string intentID = "com.magicleap.intent.action.FITTING";
📄️ Explicit Intent Example
Explicit intents specify which application will satisfy the intent, by supplying either the target app's package name or a fully-qualified component class name. Explicit Intents can also be used to pass data to other activities.
📄️ Implicit Intent Example
Implicit Intents do not directly specify the Android components which should be called, it only specifies an action to be performed. This allows a component from another app to handle the action request. For example, you may want to prompt the user to perform eye-tracking calibration.
📄️ Battery Intents
This section demonstrates how to collect battery information from the Magic Leap 2's Compute Pack and Controller in Unity. See the Android Intents Overview guide for information regarding the native implementation.