Ranja AZ 2 Posted May 27, 2021 (edited) Hello! Please, I need help about sending and receiving USSD: how will my program intercept the returned string. Here is the code I am using for sending first USSD code: unit UTestPhoneDialer; interface uses System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Platform, FMX.PhoneDialer, FMX.StdCtrls, FMX.Controls.Presentation, FMX.Edit, FMX.Memo.Types, FMX.ScrollBox, FMX.Memo; type TForm1 = class(TForm) lblCarrierName: TLabel; lblISOCountryCode: TLabel; btnGetCarrierInfo: TButton; lblTelephoneNumber: TLabel; edtTelephoneNumber: TEdit; btnMakeCall: TButton; Memo1: TMemo; procedure btnGetCarrierInfoClick(Sender: TObject); procedure btnMakeCallClick(Sender: TObject); private { Déclarations privées } PhoneDialerService: IFMXPhoneDialerService; public { Déclarations publiques } constructor Create(AOwner: TComponent); override; end; var Form1: TForm1; implementation {$R *.fmx} {$R *.LgXhdpiPh.fmx ANDROID} procedure TForm1.btnGetCarrierInfoClick(Sender: TObject); begin { test whether the PhoneDialer services are supported on your device } if Assigned(PhoneDialerService) then begin { if yes, then update the labels with the retrieved information } lblCarrierName.Text := 'Carrier Name: ' + PhoneDialerService.GetCarrier.GetCarrierName; lblISOCountryCode.Text := 'ISO Country Code: ' + PhoneDialerService.GetCarrier.GetIsoCountryCode; end; end; procedure TForm1.btnMakeCallClick(Sender: TObject); begin { test whether the PhoneDialer services are supported on your device } if Assigned(PhoneDialerService) then begin { if the Telephone Number is entered in the edit box then make the call, else display an error message } if edtTelephoneNumber.Text <> '' then PhoneDialerService.Call(edtTelephoneNumber.Text) else begin ShowMessage('Please type-in a telephone number.'); edtTelephoneNumber.SetFocus; end; end; end; constructor TForm1.Create(AOwner: TComponent); begin inherited Create(AOwner); TPlatformServices.Current.SupportsPlatformService(IFMXPhoneDialerService, IInterface(PhoneDialerService)); end; end. After first calling, Then I would have to respond to the different USSD information. How do I do? Regard! Edited May 27, 2021 by Ranja AZ Share this post Link to post
khaledAlamdar 0 Posted 9 hours ago hi If you find it, don't forget to share it with us. Thank you in advance. Share this post Link to post
Dave Nottage 612 Posted 9 hours ago 15 minutes ago, khaledAlamdar said: If you find it, don't forget to share it with us. This is not the same approach as what Ranja was trying, however it might be what you are looking for: https://github.com/DelphiWorlds/Playground/tree/main/Demos/UssdRequester 1 Share this post Link to post
khaledAlamdar 0 Posted 8 hours ago Thank you for your quick response.🧡 But I couldn't find the file DW.Permissions.Helpers to run it. Share this post Link to post
Dave Nottage 612 Posted 8 hours ago 24 minutes ago, khaledAlamdar said: But I couldn't find the file DW.Permissions.Helpers From the readme: "NOTE This code is dependent on code from the Kastri repo." Share this post Link to post