skip to Main Content

I’m encountering an issue with my React Native app when deploying it to the Google Play Store for production release. The app utilizes the react-native-otp-verify library for auto-reading OTP messages. While the functionality works perfectly in local development, I’m facing challenges with SMS permissions when deploying to the Play Store.

Here’s a snippet of the relevant code:

import {
  getHash,
  startOtpListener,
  removeListener,
} from 'react-native-otp-verify';

// // using methods
useEffect(() => {
  getHash()
    .then(hash => {
      // use this hash in the message.
      console.log('hash', hash);
    })
    .catch(console.log);

  startOtpListener(message => {
    console.log('message', message);
    // extract the otp using regex e.g. the below regex extracts 4 digit otp from message
    const otpMessage = /(d{6})/g.exec(message)[1];
    console.log('otpMessage', otpMessage);
    setAuto(true);
    setOTP(otpMessage);
  });
  return () => removeListener();
}, []);

I’ve already ensured that the hash IDs match between the Play Store and the received message on the phone. However, despite selecting "Default SMS handler" in the SMS and Call log permissions, my app got rejected.

In my AndroidManifest file, I’ve set the necessary permissions:

<!-- <uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.RECEIVE_SMS" /> -->

I’m uncertain about the correct options to choose for SMS and Call log permissions on the Play Console. Could someone guide me on the appropriate selections to resolve this issue?

Your assistance would be greatly appreciated. Thank you!

2

Answers


  1. Your app isn’t a default SMS handler. The default SMS handler is the app that writes the SMS database for all incoming texts. Basically, its the special permission your phone’s text messaging app needs. You don’t need that just to read a single message. In fact claiming it is a huge red flag that your app is either malware or the devs don’t know what they’re doing (in this case it’s the second).

    Login or Signup to reply.
  2. I had this problem as the same. Instead of sending sms throw your application, Intent to default sms application with the receiver and its content.

    Sample code with a blank text intended for the chosen recipient.

    import {Linking, Platform} from ‘react-native’

    const url = (Platform.OS === 'android')
      ? 'sms:1-408-555-1212?body=yourMessage'
      : 'sms:1-408-555-1212'
    
    Linking.canOpenURL(url).then(supported => {
      if (!supported) {
        console.log('Unsupported url: ' + url)
      } else {
        return Linking.openURL(url)
      }
    }).catch(err => console.error('An error occurred', err))
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search