is there any package to catch all sms data(sent and recived) in android sms database in react native? I want to create sms manager application for android, but i cant find any package for this task in npm packages or github. in your opinion,on this task ,are java and android studio the best choices?
Asked
Active
Viewed 1,203 times
1 Answers
1
For android, you can try this Module
https://www.npmjs.com/package/react-native-android-sms-listener
import SmsListener from 'react-native-android-sms-listener'
SmsListener.addListener(message => { console.info(message) })
The contents of the message object will be Something Like This
{
originatingAddress: string,
body: string,
timestamp: number
}
This Package is A Bit More Better Than The Above One
You Can Use It This Way
import SmsRetriever from 'react-native-sms-retriever';
// Get the phone number (first gif)
_onPhoneNumberPressed = async () => {
try {
const phoneNumber = await SmsRetriever.requestPhoneNumber();
} catch (error) {
console.log(JSON.stringify(error));
}
};
// Get the SMS message (second gif)
_onSmsListenerPressed = async () => {
try {
const registered = await SmsRetriever.startSmsRetriever();
if (registered) {
SmsRetriever.addSmsListener(event => {
console.log(event.message);
SmsRetriever.removeSmsListener();
});
}
} catch (error) {
console.log(JSON.stringify(error));
}
};
IOS SMS reading is not possible but I have read this StackOverflow answer But I have no idea how to implement that! Automatic OTP verification in iOS?.

Belgin Android
- 309
- 5
- 19