Code:
Linking.openURL('sms:'+number+'?body=Hi');
I try to open message app with mobile no and content.but mobile no and content combine together in to section.How to fix this issue?any help will be appricated.thanks in advance
Code:
Linking.openURL('sms:'+number+'?body=Hi');
I try to open message app with mobile no and content.but mobile no and content combine together in to section.How to fix this issue?any help will be appricated.thanks in advance
The working syntax on iOS (as at 11.2) appears to be sms:123&body=mybody
, note the &
as a separator rather than ?
.
Be warned though this &
separator is contrary to RFC5724 (and Android), so somewhat likely to change in future iOS versions.
Also, interestingly Apple has this to say (emphasis added):
The format for URLs of this type is
sms:<phone>
, where<phone>
is an optional parameter that specifies the target phone number of the SMS message. This parameter can contain the digits 0 through 9 and the plus (+), hyphen (-), and period (.) characters. The URL string must not include any message text or other information.
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, in order to have multiple numbers already selected in iOS:
Linking.openURL(`sms:&addresses=replace_with_comma_seperated_numbers&body=My sms text`);
this is working for me on ios. you can provide comma separated numbers.
Linking.openURL(`sms:/open?addresses=923335251661,9231213341&body=My sms text`);
Here is what i do....
Linking.openURL(`sms:${phone}?body=${msg}`)
give it a try!!!
For opening message box
Linking.openURL(`sms:${"9210457731"}?body= `)
For opening message box with text
Linking.openURL(`sms:${"9210457731"}?body= 'Hi ram ji' `)
const onPressMobileNumberClick = (number) => {
let phoneNumber = '';
if (Platform.OS === 'android') {
phoneNumber = `tel:${number}`;
} else {
phoneNumber = `telprompt:${number}`;
}
Linking.openURL(phoneNumber);
}
const onPressEmailClick = (email) => {
Linking.openURL('mailto:'+email)
// Linking.openURL('mailto:Care@amazon.com')
}
const onPressMessageClick = (email) => {
Linking.openURL(`sms:${"9210457731"}?body= `)
}