12

The app will not work unless you update the Google Play Services error on a real...

 3 years ago
source link: https://www.codesd.com/item/the-app-will-not-work-unless-you-update-the-google-play-services-error-on-a-real-device.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

The app will not work unless you update the Google Play Services error on a real device

advertisements

I am using Firebase Auth for my app, in some devices it throws me that error, my firebase dependencies are 9.6.1.

1:Can i do something against this?

2:The onComplete never gets called so i cant know if the user doesnt support this, how could i handle it?

3:Are there a lot of devices with version of google play services lower than that?

Thanks


During app initialization, your code should call GoogleApiAvailability.makeGooglePlayServicesAvailable(). The invoked processing:

Attempts to make Google Play services available on this device. If Play Services is already available, the returned Task may complete immediately.

If it is necessary to display UI in order to complete this request (e.g. sending the user to the Google Play store) the passed Activity will be used to display this UI.

It is recommended to call this method from onCreate(Bundle). If the passed Activity completes before the returned Task completes, the Task will fail with a CancellationException.

Example use in onCreate() of main Activity:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    GoogleApiAvailability.getInstance().makeGooglePlayServicesAvailable(this)
        .addOnCompleteListener(this, new OnCompleteListener<Void>() {
            @Override
            public void onComplete(@NonNull Task<Void> task) {
                if (task.isSuccessful()) {
                    Log.d(TAG, "onComplete: Play Services OKAY");
                } else {
                    // Show the user some UI explaining that the needed version
                    // of Play Services could not be installed and the app can't run.
                }
            }
    });

    ...
}


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK