Jump to content

Maher Tannous

Members
  • Content Count

    17
  • Joined

  • Last visited

Community Reputation

3 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Maher Tannous

    Android 13 ( 64-bit ) storage permission problem

    I solved my problem with this code {$IF DEFINED(ANDROID)} var imagee, videoo, audioo, state, read, write, camera: string; {$ENDIF} begin {$IFDEF ANDROID} state := JStringToString(TJManifest_permission.JavaClass.Read_phone_state); camera := JStringToString(TJManifest_permission.JavaClass.camera); read := JStringToString (TJManifest_permission.JavaClass.READ_EXTERNAL_STORAGE); write := JStringToString (TJManifest_permission.JavaClass.WRITE_EXTERNAL_STORAGE); if JStringToString(TJBuild_VERSION.JavaClass.RELEASE) = '13' then Begin imagee := JStringToString (TJManifest_permission.JavaClass.READ_MEDIA_IMAGES); videoo := JStringToString(TJManifest_permission.JavaClass.READ_MEDIA_VIDEO); audioo := JStringToString(TJManifest_permission.JavaClass.READ_MEDIA_AUDIO); PermissionsService.requestPermissions([state, camera, imagee, videoo, audioo, read, write], nil, nil); End else PermissionsService.requestPermissions([state, camera, read, write], nil, nil); {$ENDIF}
  2. I have a problem with phones running on Android 13 ( 64-bit ) I am using Delphi 11.3 and Android sdk with api 34 and MobilePermissions Component MobilePermissions The problem is that the storage permission does not work in Android 13 (64-bit), while it works on Android 11 and 12 (64-bit). Any help please
  3. Maher Tannous

    Application fail to start on android 10-11-12-13 IMEI

    I want to protect my app with imei to be run on only one device do you have another solution for running the app on one device only ? thx
  4. I tried to get IMEI number and succeeded in all Android versions except 10-11-12-13 in versions 10-11-12-13 the application not shown the main form I am using Android sdk 26.1.1.32 with api level 33 and android-ndk-r21 and jdk-17.0.6.10 and the default jar libraries and delphi 11.3 my code : procedure Tmainform.FormShow(Sender: TObject); var tm: JTelephonyManager; IMEI: String; begin IMEI := ''; if MobilePermissions1.Dangerous.ReadPhoneState = false then Begin MobilePermissions1.Dangerous.ReadPhoneState := true; MobilePermissions1.Apply; End; tm := TJTelephonyManager.Create; IMEI := JStringtoString(tm.getImei); End;
  5. Maher Tannous

    return arrays in datasnap

    Hello I want an example for returning an array in datasnap server method I tryed to make function to return an array in server side but when generate client classes from client side delphi convert the array to string any help ?
  6. Maher Tannous

    Call from sim 2

    Thank you very much this is my working code 1- Use this unit https://github.com/DelphiWorlds/KastriFree/blob/master/API/DW.Androidapi.JNI.Telecom.pas 2- procedure CallByPhoneNumber(const PhoneNumber: string; SIMindex: Integer); var Intent: JIntent; LService: JObject; LAccounts: JList; begin LService := TAndroidHelper.Context.getSystemService (TJContext.JavaClass.TELECOM_SERVICE); Intent := TJIntent.JavaClass.init(TJIntent.JavaClass.ACTION_CALL); Intent.setFlags(TJIntent.JavaClass.FLAG_ACTIVITY_NEW_TASK); Intent.setData(TJnet_Uri.JavaClass.parse(StringToJString('tel:' + JStringToString(TJnet_Uri.JavaClass.encode(StringToJString (PhoneNumber)))))); Intent.putExtra(StringToJString('com.android.phone.force.slot'), true); Intent.putExtra(StringToJString('Cdma_Supp'), true); Intent.putExtra(StringToJString('extra_asus_dial_use_dualsim'), SIMindex); Intent.putExtra(StringToJString('com.android.phone.extra.slot'), SIMindex); Intent.putExtra(StringToJString('slot'), SIMindex); Intent.putExtra(StringToJString('simslot'), SIMindex); Intent.putExtra(StringToJString('sim_slot'), SIMindex); Intent.putExtra(StringToJString('subscription'), SIMindex); Intent.putExtra(StringToJString('Subscription'), SIMindex); Intent.putExtra(StringToJString('phone'), SIMindex); Intent.putExtra(StringToJString('com.android.phone.DialingMode'), SIMindex); Intent.putExtra(StringToJString('simSlot'), SIMindex); Intent.putExtra(StringToJString('slot_id'), SIMindex); Intent.putExtra(StringToJString('simId'), SIMindex); Intent.putExtra(StringToJString('simnum'), SIMindex); Intent.putExtra(StringToJString('phone_type'), SIMindex); Intent.putExtra(StringToJString('slotId'), SIMindex); Intent.putExtra(StringToJString('slotIdx'), SIMindex); Intent.putExtra(StringToJString('simSlotName'), SIMindex); LAccounts := TJTelecomManager.Wrap(TAndroidHelper.JObjectToID(LService)) .getCallCapablePhoneAccounts; if LAccounts <> nil then Intent.putExtra (StringToJString('android.telecom.extra.PHONE_ACCOUNT_HANDLE'), TJPhoneAccountHandle.Wrap(TAndroidHelper.JObjectToID (LAccounts.get(SIMindex)))); TAndroidHelper.Context.startActivity(Intent); end; 3- CallByPhoneNumber(mobilenumber, 0); or CallByPhoneNumber(mobilenumber, 1);
  7. Maher Tannous

    Call from sim 2

    Intent.putExtra(StringToJString('android.telecom.extra.PHONE_ACCOUNT_HANDLE'), LPhoneAccountHandle); does not accept LPhoneAccountHandle I must use JString or integer value
  8. Maher Tannous

    Call from sim 2

    Thank you procedure CallByPhoneNumber(const PhoneNumber: string; SIMindex: Integer); var Intent: JIntent; LService: JObject; LAccounts: JList; LPhoneAccountHandle: JPhoneAccountHandle; I: Integer; begin LService := TAndroidHelper.Context.getSystemService (TJContext.JavaClass.TELECOM_SERVICE); Intent := TJIntent.JavaClass.init(TJIntent.JavaClass.ACTION_CALL); Intent.setFlags(TJIntent.JavaClass.FLAG_ACTIVITY_NEW_TASK); Intent.setData(TJnet_Uri.JavaClass.parse(StringToJString('tel:' + JStringToString(TJnet_Uri.JavaClass.encode(StringToJString (PhoneNumber)))))); Intent.putExtra(StringToJString('com.android.phone.force.slot'), true); Intent.putExtra(StringToJString('Cdma_Supp'), true); Intent.putExtra(StringToJString('extra_asus_dial_use_dualsim'), SIMindex); Intent.putExtra(StringToJString('com.android.phone.extra.slot'), SIMindex); Intent.putExtra(StringToJString('slot'), SIMindex); Intent.putExtra(StringToJString('simslot'), SIMindex); Intent.putExtra(StringToJString('sim_slot'), SIMindex); Intent.putExtra(StringToJString('subscription'), SIMindex); Intent.putExtra(StringToJString('Subscription'), SIMindex); Intent.putExtra(StringToJString('phone'), SIMindex); Intent.putExtra(StringToJString('com.android.phone.DialingMode'), SIMindex); Intent.putExtra(StringToJString('simSlot'), SIMindex); Intent.putExtra(StringToJString('slot_id'), SIMindex); Intent.putExtra(StringToJString('simId'), SIMindex); Intent.putExtra(StringToJString('simnum'), SIMindex); Intent.putExtra(StringToJString('phone_type'), SIMindex); Intent.putExtra(StringToJString('slotId'), SIMindex); Intent.putExtra(StringToJString('slotIdx'), SIMindex); LAccounts := TJTelecomManager.Wrap(TAndroidHelper.JObjectToID(LService)) .getCallCapablePhoneAccounts; for I := 0 to LAccounts.size - 1 do begin LPhoneAccountHandle := TJPhoneAccountHandle.Wrap (TAndroidHelper.JObjectToID(LAccounts.get(I))); if (LAccounts <> null) AND (LAccounts.size() > 0) then Begin Intent.putExtra('Android.telecom.extra.PHONE_ACCOUNT_HANDLE', LAccounts.get(0)); End else if (LAccounts <> null) AND (LAccounts.size() > 1) then Begin Intent.putExtra('Android.telecom.extra.PHONE_ACCOUNT_HANDLE', LAccounts.get(1)); End; end; TAndroidHelper.Context.startActivity(Intent); End; I got an error here ( LAccounts.get(0) ) it returns an TJObject but Intent.putExtra reqired a Byte
  9. Maher Tannous

    Call from sim 2

    can any one make an example working project for me ? thanks a lot
  10. Maher Tannous

    Call from sim 2

    Thank you but I have to put all files from this page https://github.com/FMXExpress/android-object-pascal-wrapper/tree/master/android-28 in my project folder !!!
  11. Maher Tannous

    Call from sim 2

    This to call TelecomManager var telService: JObject; telService := TAndroidHelper.Activity.getSystemService (TJContext.JavaClass.TELECOM_SERVICE); But the problem is how to call : getCallCapablePhoneAccounts
  12. Maher Tannous

    Call from sim 2

    my android version is 9 samsung j7 pro and I configured to ask me on each call i make to choose a sim to be used and it always show me dialog to choose sim to call from maybe the problem in android version
  13. Maher Tannous

    Call from sim 2

    have you tried to call from sim 2 ?
  14. Maher Tannous

    Call from sim 2

    sorry for that but it does not work your code is asking me to choose between sim card and if I choose sim 2 it calling the number *155 it does not run ussd code for *155# it removes # and call *155 may be some one can test the code and tell me what happining Thanks
  15. Maher Tannous

    Call from sim 2

    hello please i need help i want to call a number from sim2 card I want to request USSD code from sim2 slot without change any thing in android settings any help to do that in delphi fmx android some one send me this Intent intent = new Intent(Intent.ACTION_CALL); intent.putExtra("com.android.phone.extra.slot", 1); //For sim 2 intent.putExtra("simSlot", 1); //For sim 2 intent.setData(Uri.parse("tel:" + "**********")); I tried this without success I replaced "com.android.phone.extra.slot" with TJIntent.JavaClass.EXTRA_PHONE_NUMBER but I can't find any thing to replace with "simSlot" ???? My code : uses Androidapi.JNI.GraphicsContentViewText, Androidapi.JNI.Net, var mobilenumber : string; Intent : JIntent; Begin mobilenumber:='*155#'; Intent := TJIntent.Create; Intent.setAction(TJIntent.JavaClass.ACTION_CALL); Intent.putExtra(TJIntent.JavaClass.EXTRA_PHONE_NUMBER, 1); Intent.putExtra(TJIntent.JavaClass.EXTRA_INDEX, 1); Intent.setData(TJnet_Uri.JavaClass.parse (StringtoJString(mobilenumber))); TAndroidHelper.Context.startActivity(Intent); End;
×