Respond to an iOS open message app with default text

enter image description here

Code: Linking.openURL('sms:'+number+'?body=Hi'); 

I am trying to open a messaging app with a mobile phone no and content.but, but no mobile and the contents are merged together into a section. How to fix this problem? Any help would be appricated.thanks in advance

0
source share
3 answers

The working syntax on iOS (as in 11.2) looks like sms:123&body=mybody , pay attention to & as a separator, and not on ? ,

Be careful, although this & separator is contrary to RFC5724 (and Android), so it may change slightly in future versions of iOS.

It's also interesting that Apple has this to say (emphasized by me):

The format of the URLs of this type is sms:<phone> , where <phone> is an optional parameter indicating the target phone number of the SMS message. This parameter can contain numbers from 0 to 9 and symbols of plus (+), hyphen (-) and period (.). The URL string must not contain message text or other information.

+2
source

this works for me on ios. you can specify numbers separated by commas.

Linking.openURL('sms: /open?addresses=923335251661,9231213341&body=My sms text');

0
source

If you want the user to select from contacts, you can pass null as follows:

 Linking.openURL('sms:?addresses=null&body=My sms text'); 

Otherwise

 Linking.openURL('sms:?addresses=replace_with_comma_seperated_numbers&body=My sms text'); 
0
source

Source: https://habr.com/ru/post/1245581/


All Articles