I’ve started to learn Android JNI and how to use it in android applications in delphi xe8. however, i’ve tried to get phone number.. but it return to me encoded string?!
uses
…, Androidapi.JNI.Telephony, Androidapi.JNI.Provider;
var
obj: JObject;
tm: JTelephonyManager;
identifier: String;
begin
obj := SharedActivityContext.getSystemService(TJContext.JavaClass.TELEPHONY_SERVICE);
if obj <> nil then
begin
tm := TJTelephonyManager.Wrap( (obj as ILocalObject).GetObjectID );
if tm <> nil then
identifier := JStringToString(tm.getLine1Number);
end;
if identifier = ” then
identifier := JStringToString(TJSettings_Secure.JavaClass.getString(SharedActivity.getContentResolver,
TJSettings_Secure.JavaClass.ANDROID_ID));
Memo1.Lines.Add(identifier );
end;
also I’ve tired to get email address from the calss JUserAddress in Androidapi.JNI.PlayServices, but the error was integer overflow?! it will be great if there is another way to get email address. many thanks in advance..