This module is used to send an SMS message to a specific phone number.
The sms module contains the following function.
send(String number, String message)
In order to send an SMS message via send()
function, the following permission should be included in the AndroidManifest.xml file.
<uses-permission android:name="android.permission.SEND_SMS"/>
The above function is used to perform the following activities.
is used to send an SMS message to a phone number specified by number
parameter having a content specified by message
parameter.
import { Sms } from "react-native-system-applications";
...
...
....
_sendSms = () => {
Sms.send("+123456789", "Hi, how are you?").then((res) => {
// do something
}).catch((err) => {
console.log(err);
});
}
Call to _sendSms()
function sends an SMS message to the number passed as the first parameter where the content of the message is passed as the second parameter. A promise rejection will be sent for unsuccessful requests.