Cannot get Serial Number of the Magic Leap Device using Android System Properties

Give us as much detail as possible regarding the issue you're experiencing.

Unity Editor version: 2022.2.12f1
ML2 OS version:Version 1.2.0
Build B3E.230330.11-R.044
Android API Level 29

MLSDK version:1.7.0
Host OS: (Windows/MacOS): Windows11


I'm trying to get the Serial Number information of the ML2 device using the following c# code in Unity App

AndroidJavaClass SystemProperties = new AndroidJavaClass("android.os.SystemProperties");
string model = SystemProperties.CallStatic<string>("get", "ro.boot.serialno");
 Debug.Log("Android Model: " + model);

In addition to the Serial Number , I'm also retrieving the build version .

When I run the app in ML2 , It returns the build version but not the Serial Number

I verified that the property name is correct and running the adb shell getprop command returns the value for the "ro.boot.serialno" property

Hi @sageer.nakhawa

Magic Leap 2 is running an Android 10 based operating system. Since Android 10, applications require the android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE permission which is only available to system applications.

1 Like

Where do I add this , I notice there are 2 manifest files in the project I'm working on .
One under Assets->Plugins->Android and another under Thirdsparty->Plugins->Android


Do you mean that the application doesn't have the permission to access it at all ?

Correct, getting the devices serial number is not supported.