Dear Magic Leap Support Team,
I trust this message finds you well. I am reaching out to you today in the hopes of receiving assistance regarding a specific challenge I am encountering with my Android application when operating it on the ML2 Glasses.
The application operates perfectly in landscape mode on other devices, such as Pico 3&4 Headsets, ThirdEye Gen X2 Headsets, as well as standard Android devices. However, when attempting to run the same application on ML2 Glasses, it fails to function as intended despite having made the appropriate modifications in the Manifest.xml file.
Moreover, we have experienced instances where buttons were unresponsive in portrait mode. This issue is not exclusive to our application, as we have witnessed similar outcomes with multiple Android applications, all of which are developed in Java.
To provide further context, we have consulted the following resources in our attempts to address these issues:
- Modifying APK Guide: https://developer-docs.magicleap.cloud/docs/guides/native/modifying-apk
- Android Studio Workflow Guide: https://developer-docs.magicleap.cloud/docs/guides/native/getting-started/android-studio-workflow
Unfortunately, the recommended solutions offered in the aforementioned documents have not resolved our difficulties. As a result, we would greatly appreciate any guidance or insight you could provide to assist us in resolving these issues.
Please find attached the contents of our AndroidManifest.xml file, for your reference:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.ml2quickpractice">
<uses-feature android:name="com.magicleap.api_level" android:version="20" />
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.ML2QuickPractice"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:exported="true"
android:configChanges="orientation|keyboardHidden"
android:launchMode="singleTask">
<meta-data android:name="com.magicleap.augmented_reality_only" android:value="true" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Declare SecondActivity here -->
<activity
android:name=".SecondActivity"
android:exported="true">
</activity>
</application>
</manifest>
Your support in this matter is greatly appreciated. I look forward to hearing from you soon.
Best regards,
Muhammad Usman Bashir
I am attaching the logs file obtain using ADB tools;
Package name of my demo application;
com.example.ml2quickpractice
I didn't find any potential issues at all.
ML2 Log.txt (6.2 MB)
Hi @usman.bashir ,
Can you please clarify which OS and MLSDK version you are using?
Additionally, can you explain what behavior you expect to see and what do you actually experience when running this app as it is now?
Components:
- Operating System: Windows
- Development Environment: Android Studio (Latest Version)
- SDK: Magic Leap SDK
- SDK Version: v0.53.1
Development Activities:
- Downloaded C Samples for Native Applications.
Questions and Concerns:
- Are there any limitations to developing UI using C/C++ OpenGL with Magic Leap SDK?
- What are the potential limitations if I choose to develop applications using only Java?
- Is Magic Leap exclusively supportive of Native Application development using CMake?
I understand that Magic Leap requires the OpenGL library to provide a 3D immersive experience for apps. However, why are 2D apps behaving strangely, such as buttons not being clickable?
Hi @usman.bashir
Here are some brief answers to your questions-
As for the question about support for landscape orientation, I would expect non-immersive Android apps that are meant to run exclusively in landscape to run on ML2, but the dimensions of the virtual display will not change. (it will still appear to be in portrait mode) I will ask internally if there is currently any way for apps to manipulate the dimensions of the slate.
As for the issue related to missed button presses, do you have a sample application that you could point to that exhibits the problem? I'd be happy to see if I can reproduce the issue. From my cursory testing, button presses in an sample app that uses Android UI toolkit do register when using the ML2 controller.
Are there any limitations to developing UI using C/C++ OpenGL with Magic Leap SDK?
You can use OpenGL/OpenGL ES for rendering with either the MagicLeap C apis or OpenXR if you'd like. See C graphics api documentation here- MLGraphicsCreateClientGL ml_graphics.h | MagicLeap Developer Documentation
What are the potential limitations if I choose to develop applications using only Java?
MagicLeap does not provide Java bindings for its C apis and I'm not aware of bindings for OpenXR. You're free to attempt building a Java wrapper yourself if you wish, but it's not supported out of the box.
Is Magic Leap exclusively supportive of Native Application development using CMake?
Developing for MagicLeap 2 is very similar to any other Android device. You're free to use whatever build system you wish. I would recommend at least sticking with Gradle to build and package your application, even if you don't want to leverage CMake to build the native portions of your app/library.
Hope that helps!
Just to confirm- I verified with our OS team that changing the dimensions/rotation of the virtual display you see when you run a non-immersive Android app on ML2 is not currently supported.
However, I think supporting landscape is a good idea and after chatting with our OS team, it's possible that the feature could make it into future ML OS releases in some form. Thanks for asking the question!
Hi aheaney,
Thank you for your prompt response and providing answers to my questions. I appreciate your assistance. However, I have a couple of clarifications:
Regarding the support for landscape orientation, when you mentioned non-immersive Android apps, did you mean simple Android apps developed in Java? I wanted to confirm this as I'm unclear about the term "non-immersive."
Additionally, for the issue related to missed button presses, I can provide you with an APK of the sample application that exhibits the problem. This way, you can test it thoroughly and see if you can reproduce the issue on your end. Please let me know if you would like to proceed with this.
Thank you once again for your help and guidance.
Best regards,