Hello everybody,
I am trying to get the IMEI of a device with the following code. This code is inserted in an Activity:
I get this error:
PackageAdded: package:dhqi.trial.project12
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
main_vvvvvvvvvvvvvvvv7 (java line: 1397)
java.lang.RuntimeException: Method: GetTayt not found in: java.util.Locale
at anywheresoftware.b4j.object.JavaObject$MethodCache.getMethod(JavaObject.java:366)
at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:119)
at dhqi.trial.project12.main$ResumableSub_RunFromActivityCreate.resume(main.java:1818)
at dhqi.trial.project12.main._vvvvvvvvvvvvvvvv4(main.java:1796)
at dhqi.trial.project12.main$ResumableSub_xmls_EndElement.resume(main.java:2940)
at dhqi.trial.project12.main._xmls_endelement(main.java:2375)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:186)
at anywheresoftware.b4a.objects.SaxParser$MyHandler.endElement(SaxParser.java:121)
at org.apache.harmony.xml.ExpatParser.endElement(ExpatParser.java:156)
at org.apache.harmony.xml.ExpatParser.appendBytes(Native Method)
at org.apache.harmony.xml.ExpatParser.parseFragment(ExpatParser.java:513)
at org.apache.harmony.xml.ExpatParser.parseDocument(ExpatParser.java:474)
at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:316)
at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:279)
at anywheresoftware.b4a.objects.SaxParser.parse(SaxParser.java:80)
at anywheresoftware.b4a.objects.SaxParser.Parse(SaxParser.java:73)
at dhqi.trial.project12.main$ResumableSub_CheckIfActivationIsStillActive.resume(main.java:1279)
at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:240)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:180)
at anywheresoftware.b4a.keywords.Common$11.run(Common.java:1135)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)
I have added the required manifest and runtime permission READ_PHONE_STATE but still I get this. I cannot figure out what I am doing wrong... Some advice will be highly appreciated.
Thanks in advance
I am trying to get the IMEI of a device with the following code. This code is inserted in an Activity:
B4X:
Sub GetImei As String
Return jo.RunMethod("GetTayt", Null)
End Sub
#IF JAVA
import android.telephony.TelephonyManager;
import android.content.Context;
public String GetTayt() {
TelephonyManager tManager = (TelephonyManager)this.getSystemService(Context.TELEPHONY_SERVICE);
String uid = tManager.getDeviceId();
return uid;
}
#End If
I get this error:
PackageAdded: package:dhqi.trial.project12
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
main_vvvvvvvvvvvvvvvv7 (java line: 1397)
java.lang.RuntimeException: Method: GetTayt not found in: java.util.Locale
at anywheresoftware.b4j.object.JavaObject$MethodCache.getMethod(JavaObject.java:366)
at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:119)
at dhqi.trial.project12.main$ResumableSub_RunFromActivityCreate.resume(main.java:1818)
at dhqi.trial.project12.main._vvvvvvvvvvvvvvvv4(main.java:1796)
at dhqi.trial.project12.main$ResumableSub_xmls_EndElement.resume(main.java:2940)
at dhqi.trial.project12.main._xmls_endelement(main.java:2375)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:186)
at anywheresoftware.b4a.objects.SaxParser$MyHandler.endElement(SaxParser.java:121)
at org.apache.harmony.xml.ExpatParser.endElement(ExpatParser.java:156)
at org.apache.harmony.xml.ExpatParser.appendBytes(Native Method)
at org.apache.harmony.xml.ExpatParser.parseFragment(ExpatParser.java:513)
at org.apache.harmony.xml.ExpatParser.parseDocument(ExpatParser.java:474)
at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:316)
at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:279)
at anywheresoftware.b4a.objects.SaxParser.parse(SaxParser.java:80)
at anywheresoftware.b4a.objects.SaxParser.Parse(SaxParser.java:73)
at dhqi.trial.project12.main$ResumableSub_CheckIfActivationIsStillActive.resume(main.java:1279)
at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:240)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:180)
at anywheresoftware.b4a.keywords.Common$11.run(Common.java:1135)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)
I have added the required manifest and runtime permission READ_PHONE_STATE but still I get this. I cannot figure out what I am doing wrong... Some advice will be highly appreciated.
Thanks in advance