Closed appielife closed 4 years ago
Can someone please confirm ?
Thanks Gagan
Confirmed. Not working for API Version >= 26
Solved the issue by Requesting SMS Read permission and SMS Receive permissions when starting the react native app.
import { PermissionsAndroid } from 'react-native';
componentDidMount() {
this.requestReadSmsPermission();
}
async requestReadSmsPermission() {
try {
var granted = await PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.READ_SMS,
{
title: "Auto Verification OTP",
message: "need access to read sms, to verify OTP"
}
);
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
console.log("sms read permissions granted", granted);
granted = await PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.RECEIVE_SMS,{
title: "Receive SMS",
message: "Need access to receive sms, to verify OTP"
}
);
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
console.log("RECEIVE_SMS permissions granted", granted);
} else {
console.log("RECEIVE_SMS permissions denied");
}
} else {
console.log("sms read permissions denied");
}
} catch (err) {
console.log(err);
}
}
Tried to use permissions API but the host Activity doesn't implement PermissionAwareActivity.
Tried the above steps , but still cant seem to make it work . Permissions always return NEVER_ASK_AGAIN . I have tried uninstalling the app,clearing data,changing version number but still of no use. Any other workaround or fix for this issue ?
Ask for READ_SMS as well as RECEIVE_SMS permission, it will work in sdk version 28.
tried the above solution , permissions granted but the message not read
Tried integrating this library but its not auto reading messages. Please provide any solution
@kr4ckhe4d you made my day
The package is not working for android version greater than 8. https://developer.android.com/guide/components/broadcast-exceptions.html