0

I am doing an andorid app containing sms autoread functionality.its working perfectly in debug and release(signed apk) builds.But when is upload it to playstore,its not working.I think its because of the hash key.Both development and release hash keys are updated in server.

I have tried the keyhash conversion method from app signing certificate.(dont know whether its the correct method). How to generate 11 char hash key for Sms Retriever with Google App signing

But after running the first command getting error as:- "public keys in reply and keystore dont match"

Following is the code:-

   class RegisterActivity : AppCompatActivity(), 
   GoogleApiClient.ConnectionCallbacks,
    GoogleApiClient.OnConnectionFailedListener, 
     SMSBroadcastReciever.Listener {
   override fun onSMSReceived(otp: String) {
    if (smsBroadcast != null) {
  LocalBroadcastManager.getInstance(this).unregisterReceiver(smsBroadcast)
    }

    et1.setText(otp[0].toString())
    et2.setText(otp[1].toString())
    et3.setText(otp[2].toString())
    et4.setText(otp[3].toString())
    et4.setSelection(et4.text!!.length);
    Log.e("OTP Received", otp)
}

override fun onTimeOut() {

}
     override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)

    setContentView(R.layout.activity_otp)



    listOf(et1, et2, et3, et4).setOTPListeners()
    et1.requestFocus()
    vm = ViewModelProviders.of(this).get(RegisterVM::class.java)

    registerObservers(vm!!)
    otpVerifyBtn.setOnClickListener {
        hideKeyboard()
        submitOtp(vm!!)
    }
    mCredentialsApiClient = GoogleApiClient.Builder(this)
            .addConnectionCallbacks(this)

            .addApi(Auth.CREDENTIALS_API)
            .build()

    startSMSListener()

    smsBroadcast.injectListener(this)
    val intentFilter = IntentFilter()
    intentFilter.addAction(SmsRetriever.SMS_RETRIEVED_ACTION)


    applicationContext.registerReceiver(smsBroadcast, intentFilter)
    val mobNum = intent.getStringExtra(IntentKeys.MOBILE_NUMBER) ?: ""
    mobileNumberTV.text = getString(R.string.please_type_verification) + " 
   " + mobNum
  }
  private fun startSMSListener() {

    val client = SmsRetriever.getClient(this /* context */)
    val task = client.startSmsRetriever()
    task.addOnSuccessListener {

    }

    task.addOnFailureListener {

    }
}

@SuppressLint("LongLogTag")
private fun requestHint() {
    val hintRequest = HintRequest.Builder()
            .setPhoneNumberIdentifierSupported(true)
            .build()

    val intent = Auth.CredentialsApi.getHintPickerIntent(
            mCredentialsApiClient, hintRequest)

    try {
        startIntentSenderForResult(intent.intentSender,
                RC_HINT, null, 0, 0, 0)
    } catch (e: Exception) {
        Log.e("Error In getting Message", e.message)
    }

}

The app is working fine in debug and signed apk builds.but not working after published to playstore.Can someone help me to find an answer???

Steve Vinoski
  • 19,847
  • 3
  • 31
  • 46
Rib
  • 29
  • 4
  • **GoogleApiClient** is deprecated https://developers.google.com/android/reference/com/google/android/gms/common/api/GoogleApiClient – Rakesh R Dec 04 '19 at 10:44
  • Sorry it is not the reason..Finally i had logged the key hash and updated. – Rib Jan 23 '20 at 09:42

0 Answers0