Closed msbt2019 closed 4 years ago
give permission in android manifest:
and the component (screen ) on which you are using use PermissionsAndroid from react-native
componentDidMount() { this.readSmsPermission(); }
async readSmsPermission() { 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); } }
Any update... Same problem. Are the developers seeing this for a solution OR we need to implement this naively
It's working yet wont useful for google play store due to SMS policy .. So stop using this plugin and move towards SMS retrieving API
This is the message google send me :
Based on our review, we found your app’s expressed user experience did not match your declared core functionality {Default SMS handler (and any other core functionality usage while default handler)}. Please remove these permissions from your app.
Default handler capability was listed on your declaration form, but your app does not appear to have default handler capability. Please submit a revised declaration form.
This is my source code : componentDidMount() { if(Platform.OS === 'android') { this._requestReadSmsPermission() } }
_requestReadSmsPermission = async () => { try { const result = await PermissionsAndroid.requestMultiple([PermissionsAndroid.PERMISSIONS.RECEIVE_SMS, PermissionsAndroid.PERMISSIONS.READ_SMS])
}
And this is my androidmanifest :