Bruno-Furtado/react-native-sms-retriever

event.message returnig undefined

nikolic-milan opened this issue · 4 comments

Environment

  • React Native Version
  • Platform: Android
  • Device: Which One
  • 10
  • react-native-sms-retriever latest
  • Android Studio Version latest
  • Build Tools Version latest

Description

event.message returning undefined, SmsRetriever.requestPhoneNumber() works fine. Do I need to ask for premission?
My code just for testing

  try {
    const phoneNumber = await SmsRetriever.requestPhoneNumber();
    console.log("Phone number", phoneNumber);
    const registered = await SmsRetriever.startSmsRetriever();
    if (registered) {
      SmsRetriever.addSmsListener(event => {
        console.log("Message", event.message);
        SmsRetriever.removeSmsListener();
      }); 
    }
  } catch (error) {
    console.log(JSON.stringify(error));
  }
};

The Message I am sending

<#> This is a message: 163AD183
/jOH1cUoyR+K

The above hash code i got from running

keytool -exportcert -alias PlayDeploymentCert -keystore MyProductionKeys.keystore | xxd -p | tr -d "[:space:]" | echo -n com.trajnostnamobilnostfe `cat` | sha256sum | tr -d "[:space:]-" | xxd -r -p | base64 | cut -c1-11

I got a different one from doing the steps 2-7 from https://developers.google.com/identity/sms-retriever/verify#1_construct_a_verification_message.

And a side quesiton. Will this lib work for IOS also or not?

Thanks in advance!

Answer to side question: This library will work only on Android

I'm getting the same issue randomly in production.

Did you resolve this issue? I am experiencing the same problem

for me it because the wrong haskey