jgkiano / react-native-android-sms-verification-api

A wrapper for the android sms verification api. Includes SMS Retriever and SMS User Consent
MIT License
12 stars 6 forks source link

Getting phone number on Android 14 fails with: Didn't find class "com.google.android.gms.auth.api.credentials.HintRequest$Builder" #11

Open pke opened 1 month ago

pke commented 1 month ago

A red error box is displayed when trying to read the devices phone number:

AndroidSms VerificationApi.requestPhone

Failed resolution of: Lcom/google/android/gms/ auth/api/credentials/HintRequest$Builder;

Didn't find class "com.google.android.gms.auth.api.credentials.HintRequest$Builder"

The app becomes unresponsive for some time (30 secs) and then the red dialog disappears by itself. Sometimes the system popup with the correct phone number appears nonetheless then but tapping OK in the dialog leads to an app crash.

I assume this has something to do with the bundles Google Playstore APIs?

Might be related: https://developers.google.com/android/guides/releases#february_15_2024

jgkiano commented 1 month ago

Maybe downgrading the play-services version will work until it's patched with Credential Manager. You could try forcing it to use a previous version, lmk

configurations.all {
    resolutionStrategy {
        force 'com.google.android.gms:play-services-auth:17.0.0'
        force 'com.google.android.gms:play-services-auth-api-phone:17.4.0'
    }
}
pke commented 1 month ago

This leads to a different error 1000000023

jgkiano commented 1 month ago

I think HintRequest is too old as the pending intent is coming from that class. I've removed the deprecated class usages, lmk if v1.0.10-beta works. Remove the resolutionStrategy.

pke commented 1 month ago

Works on Android 14 (using v.1.0.10-beta.1)🎉! Shall I try on other Android versions? Or is this a back compatible API when using the proper minSDK and playstore API bundles?

jgkiano commented 1 month ago

Amazing! thanks for testing, please confirm on other android versions if you have access, it should be back compatible. Once you confirm i'll move this to npm stable.