Why SMS Retriever API don't work in release mode?

后端 未结 6 1683
难免孤独
难免孤独 2020-12-31 06:27

I\'ve implemented the SMS Retriever API like in the google tutorials and in my debug Build Variant work fine. I can read the sms and get the code to the user ca

相关标签:
6条回答
  • 2020-12-31 07:09

    Follow these steps to get the key for production:

    1. Go to the Build option.
    2. In the options, choose Select Build Variant.
    3. Then in the left corner, a dialog will open, from there Change Build Variant from debug to release.
    4. Click on run, then this dialog will open: Then this dialog will open(point 4 pic.)
    5. Click on Run, next click on Continue Anyway, then click on Yes then in the dialog In this dialog Click on the **+** in left bottom.
    6. Then fill these details: Then fill these details
    7. Now go to Build Types and follow this image: Then go to build types and follow the image
    8. And click ok.

    Now when you run the commands to get the hash through AppSignatureHelper Class, that key will be your production key.

    0 讨论(0)
  • 2020-12-31 07:14

    You must add release app string hash to message sent from server because release hash different from debug hash SMS retriever verify

    0 讨论(0)
  • 2020-12-31 07:18

    Few days ago, I had the same problem. Actually there is nothing wrong in your code. When you run your app and create hash, it create hash only for device specific. When your generate signed apk and create hash ( using log ), then this hash is only for release but not for production. In case of production, you have to install app from play store and check hash ( using logs ) and that hash will use for all users.

    Hope it will help you

    0 讨论(0)
  • 2020-12-31 07:18

    I had the same problem by using

    SMSRETRIEVERAPI

    I got the otp for debug build but when I pushed that to playstore I would not auto read the otp.Actually it will generate the hashkey based on your application build variants type.So Inorder to auto read your otp you will change the your hashkey in your server that will be generated in release mode.

    So find the Hashkey in release mode and update it in your server.Thats it you will get It.

    0 讨论(0)
  • 2020-12-31 07:22
    1. First download app signed certificate der from your play console account.
    2. Then convert it to yourkeystore.keystore with keystore extension using this command:

      keytool -import -alias your_alias -keystore file_name_created.keystore -file certificate.der

    3. Then create string hash using the created keystore.
      Use this file bash to create hash string:
      https://github.com/googlesamples/android-credentials/tree/master/sms-verification/bin

    0 讨论(0)
  • 2020-12-31 07:25

    First download your app signing certificate .der file then convert to .jks file by this command

    keytool -import -alias your_alias -keystore file_name_created -file certificate.der
    

    then new .jks file created

    then use this command for generate hash for your release

    keytool -exportcert -alias your_alias -keystore certificate.jks | xxd -p | tr -d "[:space:]" | echo -n  app_package_name `cat` | sha256sum | tr -d "[:space:]-" | xxd -r -p | base64 | cut -c1-11
    

    then create hash string and it will work on play store app.

    0 讨论(0)
提交回复
热议问题