Android Question "android_id"

Massimo66

Member
hi,
when i try to test the string of android_id widh a value a receive this error:
java.lang.ArrayIndexOutOfBoundsException: length=0; index=0

[CODE lang="b4x" title="test android_id" highlight="3"]
Dim phone As Phone
Dim sRet As String =phone.GetSettings ("android_id")
If sRet ="123456789" Then
Main.AppValid=True
End If
[/CODE]
 
Hi Erel, here the error:

Error occurred on line: 428 (syncro)
java.lang.ArrayIndexOutOfBoundsException: length=0; index=0
at java.lang.reflect.Array.get(Array.java:181)
at anywheresoftware.b4a.shell.ArraysUtils.getElement(ArraysUtils.java:76)
at anywheresoftware.b4a.shell.Shell.getArrayElement(Shell.java:584)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:383)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:205)
at anywheresoftware.b4a.debug.Debug.delegate(Debug.java:262)
at sisonweb.b4a.Track.syncro._importa_filecsv(syncro.java:2014)
at sisonweb.b4a.Track.syncro$ResumableSub_FTP_ListCompleted.resume(syncro.java:1971)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resumeAsUserSub(DebugResumableSub.java:48)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:201)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(DebugResumableSub.java:43)
at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:275)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:150)
at anywheresoftware.b4a.BA$2.run(BA.java:395)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7723)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:612)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:997)
 
Upvote 0
I solved it: it didn't work inside a resumablesub. It basically went wrong with the main variables. I solved it by moving the code to another sub.
Thanks anyway.
 
Upvote 0
hi,
when i try to test the string of android_id widh a value a receive this error:
java.lang.ArrayIndexOutOfBoundsException: length=0; index=0

[CODE lang="b4x" title="test android_id" highlight="3"]
Dim phone As Phone
Dim sRet As String =phone.GetSettings ("android_id")
If sRet ="123456789" Then
Main.AppValid=True
End If
[/CODE]
Hi , use this
[CODE lang="b4x" title="Get Android device ID"] Dim objPhone As Phone
Dim device_id As string
device_id = objPhone.GetSettings("android_id")
Log ("Connected Device id : " & device_id )[/CODE]
Good luck
 
Upvote 0

Similar Threads

Back
Top