Ninh Giang Thi,
first, ensure that you application has a permission to read SMS messages. Open the properties of the root configuration object, find "Required mobile application permissions", and add the "Telephony" permission.
Here's an example:
Code |
---|
&AtClient
Var Handler;
&AtClient
Procedure OnOpen(Cancel)
Handler = New NotifyDescription("OnIncomingSMS", ThisForm);
TelephonyTools.AttachSMSMessageHandler(Handler);
EndProcedure
&AtClient
Procedure OnClose(Exit)
TelephonyTools.DetachSMSMessageHandler(Handler);
EndProcedure
&AtServer
Procedure OnIncomingSMSSrv(_Text, _Sender)
Text = _Text;
Sender = _Sender;
EndProcedure
&AtClient
Procedure OnIncomingSMS(SMSMessage, AdditionalParameter) Export
OnIncomingSMSSrv(SMSMessage.Text, SMSMessage.Sender);
EndProcedure |