App wont run unless you update google play services error on real device

654
April 02, 2017, at 10:05 AM

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

Answer 1

I'd recommend lowering the Google Play Services version you use in your app: unless you specifically need something in a later version of Play Services? It shouldn't cause a problem for your app, but should solve the issue with users needing an update.

Answer 2

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.
                }
            }
    });
    ...
}
Rent Charter Buses Company
READ ALSO
JSON adding backslash automatically

JSON adding backslash automatically

I am trying to convert a java object to json using GsonBut when i tried printing it out

472
How to follow quick documentation links without browser?

How to follow quick documentation links without browser?

When I view quick documentation, this comes up

425
Using ajax for storing data (php) and recieving data

Using ajax for storing data (php) and recieving data

I am new to ajax/jquery and I wonder if I can store a username in a database and live update the likes cound on my websiteSo:

346
Detect device model in php

Detect device model in php

I want to detect visitor's mobile device model and return only these "android, desktop, ipad, or iphone"

305