• 11
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

Play services version issue for SMS Retriever Api

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'
    • Its strange - In release notes I can see that SMS Retriever was introduced in this version i.e 11.0 and when I try to compile and run the app with ver 11.4.2 (since my device has 11.9.x and this was introduced in 11.0) I thought it would work but Its simply giving out a NoClassDefFoundError for SmsRetrieverClient
      • 2
    • Yes I think you need to use a google play service with lower version in order for devices that have out-dated google play service libraries to work. Try simply decrease the google play service version to 11.9 or lower and try again on that device? With that said, normally devices will auto update to the latest play service version though...

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.

  • 1
Reply Report