Google Play Services Update

How do you prompt the user to update google play services?

The problem is caused by a specific condition when you have 2 issues with Google Play Services (GPS). Because GPS is also disabled Google Play Store (GPT), will not run on the device.

If your Google Play Services is out of date, then calling showErrorDialogFragment using an error code of ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED, (error code 2), which works fine.

But if your GPS is both disabled AND out-of-date, then there is an issue with the way googleApiAvailability api works.If you call isGooglePlayServicesAvailable() it will return the first error it finds, but it's not necessarily the error you want to resolve first. The problem is knowing that you have another error you need to address first. isGooglePlayServicesAvailable() does not help in this regard.

In my case play services is both disabled, AND out of date. So, the approach is to first call showErrorDialogFragment and you'll get a response error code for SERVICE_VERSION_UPDATE_REQUIRED.

Android will attempt to resolve it by sending a pendingIntent to launch Google Play Store (GPT) to update GPS, but this will fail, as GPT depends on an ENABLED version of GPS. Because you're calling showErrorDialogFragment it will call onActivityResult after it fails to launch GPT.

The next step is codig the onActivityResult. I needed to test for isGooglePlayServicesAvailable() again. If you still get the same error code (SERVICE_VERSION_UPDATE_REQUIRED), then you need to call showErrorDialogFragment again in onActivityResult, but this time pass it a different error code, ConnectionResult.SERVICE_DISABLED (error code 3). This will take the user to the app manager to ENABLE google play services first. Then when returning to the app, you need to test for isGooglePlayServicesAvailable and it should then detect google services is still out of date. If you successfully update the app, onActivityResult should allow you to determine that isGooglePlayServicesAvailable is succcessful and you can continue. Note that you will may need to add a flag that so that you know to test again for google play services compatibility rather than continue executing a startup process.

(So, really what googleApiAvailability should do is return the disabled error first (ie ConnectionResult.SERVICE_DISABLED aka error code 3), so you can resolve that first before attempting to update GPS.)

How to properly update Google Play Services

After changing the Play Service version, and installing on my phone,
android studio gave me a warning saying that I can't update the
existing application, and I must uninstall it.

its give you warning because in you device you have signed APK and you are trying to update it using debug apk. so generate signed apk(with same certificate whatever you have used previously) then update app in device.

So, can I still release the new APK in the developer console, and will
it cause issues?

in above process there is no issue then you can upload same signed apk on Google Play Store


assume you know what is signed & debug apk and how to generate both


EDITED:

Gradle is a build system. i am not able to explain it in simple way but you can read more detail of Gradle in this answer and for more about build system and Build System Overview

Android Emulator stuck on Google Play Services are Updating

Use API 24 or API 26 Android Emulator system images and you should be good to go. API 25 does not have the latest Google Play Store app pre-installed yet. Note on the screen shot that only these images are "Google Play" versions.

Android Studio 3.0 AVD Manager - System Image Selection

Google Play services are updating error on release, not emulator (Google Play Services 12.6.73, Huawei devices)

This bug is reported by many people in the Google issue tracker. It looks like a wide range of Huawei devices is severely impacted by the latest Play Services update to version 12.6.73. Apparently something changed on the Google side and they are currently investigating what is happening.

The issue is tracked in the following bug:

Authorization Failure in Google Maps Android API v2 (Google Play Services 12.6.73, Huawei devices)

Star the bug and follow messages from Google engineers.



UPDATE 2018-05-15

Some messages from the bug

Have just got off the phone to Google and Huawei. Huawei seem to be
admitting responsibility. They told me there is an EMUI update due in 1 to
2 weeks that should fix "all google maps issues".

Also ah...@google.com states

Google has been able to reproduce the problem on a physical device and is now focusing on addressing the root cause through either a fix or other mitigation.

It looks like Google and Huawei have to look into this issue together in order to provide a permanent solution.

UPDATE 2018-05-16

Google posted the following message in the bug

In collaboration with Huawei, Google engineers have identified the root cause of this issue as an unexpected change to the filesystem permissions. The issue can impact any Android app on a Huawei device which renders a Google map.

Our engineers are preparing a new version of Google Play Services which should resolve the problem. It will be targeted to devices running Android 7.0 Nougat, or higher. We will post another update with the status of the rollout.

Thanks for your patience.

UPDATE 2018-05-17

Finally good news from Google

We are pleased to report that a beta version of Google Play Services is ready. We believe this version mitigates the issue on Huawei devices running Android 7.0 Nougat, or higher. An important caveat is that each time the device is rebooted, you will need to wait about one minute before launching the affected applications.

Starting today at midnight (Pacific Time), the beta will be rolled-out to a segment of the community that has signed-up for the Google Play Services Public Beta Program. It will ramp to increasing segments of the beta audience over the next few days. We invite you to join the beta program at https://developers.google.com/android/guides/beta-program to obtain an early release of this and future versions of Google Play Services. Once beta testing is complete it will be rolled out in stages to all users.

UPDATE 2018-05-18

As a follow-up to our last update (comment#342), we believe this issue is fixed in Google Play Services version 12.6.85. If you are still encountering the problem, please ensure your device has this version installed.

As previously noted, there can be a delay (usually less than one minute) between the time the OS is finished booting and Google Play Services starts. If you launch one of the affected apps during this window, it may not render a map. If this happens, re-launch the app after a minute or so. Subsequent launches of the app should succeed every time.

FINAL UPDATE 2018-05-22

As of 10:00 AM (PDT) on May 21, 2018, Google Play Services version 12.6.85 was pushed to 100%, following the initial beta rollout. We believe this resolves the Google Play Services issue on all impacted Huawei devices.

Huawei is working on a longer term solution which is beneficial to its users and developers.

We apologize for this incident and the impact it may have caused. We are conducting an internal investigation of this issue and will make appropriate improvements to our systems to help prevent future recurrence. Stay tuned for an Incident Report.

Google Play services out of date. Requires 12800000 but found 8703448

I solved the error by updating the Google play services version using this code,

            //On button click of the google signIn 

googleSignIn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent signInIntent = mGoogleSignInClient.getSignInIntent();
startActivityForResult(signInIntent,GOOGLE_SIGNIN_ID);
}

//onActivity Result code.
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent
data) {
super.onActivityResult(requestCode, resultCode, data);

if (requestCode == GOOGLE_SIGNIN_ID){
Task<GoogleSignInAccount> googleSignInAccountTask = GoogleSignIn.getSignedInAccountFromIntent(data);
try {

GoogleSignInAccount googleSignInAccount = googleSignInAccountTask.getResult(ApiException.class);
fireBaseAuthenticationWithGoogle(googleSignInAccount);

}catch (ApiException e){

//if user doesn't have updated google play services version

if (e.getStatusCode() == 12500){

try{
// show your own AlertDialog for example:
AlertDialog.Builder builder = new AlertDialog.Builder(this);
// set the message
builder.setMessage("This app uses google play services for signing in")
.setTitle("Do you want to update?");

builder.setPositiveButton("Ok", (dialog, id) -> {

//final String appPackageName = "com.google.android.gms";
final String appPackageName = "com.google.android.gms&hl=en_IN";
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
}catch (android.content.ActivityNotFoundException anfe) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName)));
}
});
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// User cancelled the dialog
}
});
AlertDialog dialog = builder.create();
dialog.show();
}catch (Exception err){
err.printStackTrace();
}

}
}
}

put this where you got the exception. I hope it helps @matdev.



Related Topics



Leave a reply



Submit