SMS receive in 1C



Discussions regarding 1C:Enterprise for mobile devices with Android, iOS, or Windows Phone.

#1
People who like this:0Yes/0No
Active user
Rating: 3
Joined: Mar 14, 2012
Company: GSPD

Still now, I can not read SMS in Mobile device. Any one can give me a code example for receive one or all SMS message?

 
#2
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Nov 10, 2015
Company: Clever Business Solutions

&AtClient
Procedure ConnectReceiveSMS(Command)

MessageRecipient = New NotifyDescription("ReceivingMessage", ThisForm);
TelephonyTools.AttachSMSMessageHandler(MessageRecipient);
Message("Processor for receiving sms - connected!");

EndProcedure


&AtClient
Procedure ReceivingMessage(NewMessage, ExtraOptions) Export

SenderSMS = NewMessage.From;
CountAttachmentsNewSMS = NewMessage.Attachments.Count();
DateNewSMS = NewMessage.DateReceived;
TextNewSMS = NewMessage.Text;
Message("A new message has come! From" + NewMessage.From);

EndProcedure

 
#3
People who like this:0Yes/0No
Administrator
Rating: 7
Joined: Nov 3, 2011
Company: 1C Company

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

Download 3.png (18.77 KB)
 
#4
People who like this:0Yes/0No
Active user
Rating: 3
Joined: Mar 14, 2012
Company: GSPD

Thanks for all your helps.I am sorry for longtime to read this topic!

 
Subscribe