Main > Forum > 1C:Enterprise Platform > 1C:Enterprise. Mobile platform > SMS receive in 1C

Forum

Search UsersRules
SMS receive in 1C
#1
Active user
Points:: 0
Joined:: Mar 14, 2012

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?

Profile
#2
Just came
Points:: 0
Joined:: Nov 10, 2015

&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

Profile
#3
Active user
Points:: 0
Joined:: Nov 3, 2011

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

Profile
#4
Active user
Points:: 0
Joined:: Mar 14, 2012

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

Profile
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)



© 1C LLC. All rights reserved
1C Company respects the privacy of our customers and visitors
to our Web-site.