I have already integrated SMS Retriever Api and its working fine on devices with latest play services (checked with play services version 16.x.x and above)
The issue here is if I am running it on a device with Play Services 11.9.xx
then the SMS Retriever client doesn't get registered also no error is thrown it simply skips over and doesn't work !!
But As per the docs -
Prerequisites - The SMS Retriever API is available only on Android devices with Play services version 10.2 and newer.
So it should have worked with my device as play services was greater than 10.2
Please suggest what I am doing wrong !!
The code used to register client :
fun setRetrieveSmsTaskListener(context: Context) {
val client = SmsRetriever.getClient(context)
val task = client.startSmsRetriever()
task.addOnSuccessListener {
LogUtils.debugLog(LOG_TAG, "Sms retriever api task Success")
}
task.addOnFailureListener {
LogUtils.debugLog(LOG_TAG, "Failure Sms retriever api task with exception $it")
}
task.addOnCanceledListener {
LogUtils.debugLog(LOG_TAG, "Canceled Sms retriever api task with exception")
}
}
And the depencies used :
implementation 'com.google.android.gms:play-services-auth:16.0.0'
implementation 'com.google.android.gms:play-services-auth-api-phone:16.0.0'
Use lower version of play service(like below) and try again
implementation 'com.google.android.gms:play-services-auth-api-phone:11.0.4'
Or update the google play service version on device if you are using latest version of dependencies.