Closed hamidashoor closed 3 years ago
Here is not working too.
function getPermission() {
return PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.READ_SMS,
{
title: "Ola",
message: "Permissão para ver seu sms rss."
}
);
}
async function listenSms() {
const resp = await getPermission();
console.log(resp);
const lister = SmsListener.addListener(message => {
console.log(message);
addMessage(message.body);
});
setSmsListner(lister);
}
I receive granted permission, test send sms but the listener is not working.
Here is not working too.
function getPermission() { return PermissionsAndroid.request( PermissionsAndroid.PERMISSIONS.READ_SMS, { title: "Ola", message: "Permissão para ver seu sms rss." } ); } async function listenSms() { const resp = await getPermission(); console.log(resp); const lister = SmsListener.addListener(message => { console.log(message); addMessage(message.body); }); setSmsListner(lister); }
I receive granted permission, test send sms but the listener is not working.
I solve this problem, sorry. I only need to ask for "RECEIVE_SMS" permission too.
async function getPermission() {
await PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.READ_SMS,
{
title: "Ola",
message: "Permissão para ver seu sms rss."
}
);
await PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.RECEIVE_SMS, {
title: 'Receive SMS',
message: 'Need access to receive sms, to verify OTP'
}
);
}
I solve this problem, sorry. I only need to ask for "RECEIVE_SMS" permission too.
async function getPermission() { await PermissionsAndroid.request( PermissionsAndroid.PERMISSIONS.READ_SMS, { title: "Ola", message: "Permissão para ver seu sms rss." } ); await PermissionsAndroid.request( PermissionsAndroid.PERMISSIONS.RECEIVE_SMS, { title: 'Receive SMS', message: 'Need access to receive sms, to verify OTP' } ); }
don't forget to add READT_SMS and RECEIVE_SMS permissions to your AndroidManifest.xml too.
can we close this issue now since the problem is solved?
i installed the package of
react-native-android-sms-listener
and this is my code in a Function :and when I press a bottom, this code runs...
and i didn't get any alert in my application