Play services version issue for SMS Retriever Api

为君一笑 提交于 2020-01-04 13:35:08

问题


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'

回答1:


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.



来源:https://stackoverflow.com/questions/55489691/play-services-version-issue-for-sms-retriever-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!