Firebase unexpectedly requires a newer version of Google Play Services - android

I was using Firebase with the following versions in my Android app project:
compile 'com.google.firebase:firebase-core:11.2.0'
compile 'com.google.firebase:firebase-database:11.2.0'
compile 'com.google.firebase:firebase-auth:11.2.0'
compile 'com.google.firebase:firebase-messaging:11.2.0'
compile 'com.google.android.gms:play-services-ads:11.2.0'
compile 'com.google.android.gms:play-services-location:11.2.0'
//...
apply plugin: 'com.google.gms.google-services'
Then I updated my app to use the last version of Firebase, so replaced all 11.2.0 with 11.8.0 in all dependencies. It compiles fine, but now, when calling FirebaseAuth.getInstance().signInAnonymously(), the callback never returns and the sign in is not performed. This error is silent, but I had a look at the console, and I found:
Google Play services out of date. Requires 11910000 but found 11518438
Apparently my phone has version 11.5.18 of Google Play Services installed (thus the number 11518438). I know, updating Google Play Services should fix it, BUT, how is this supposed to work in a production environment? I'm sure there will a lot of users whose Google Play Services app will also be outdated. Does this mean that all of those users will suddenly have an app that doesn't work when they update it?
I know I can use makeGooglePlayServicesAvailable() but it just doesn't feel right (for example the user might not have Internet or space for an update). Will the user be forced to update every time a new version is needed? And, where is it documented that Firebase version X requires Google Play Services version X? I cannot see anything on Firebase release notes.

The release of new Play Services and Firebase SDKs only occurs after the Play Services APK has been made available to 100% of supported Android devices. The expectation is that these devices will self-update their Play APK. If that hasn't happened on a user's device for whatever reason, the user is typically prompted to update their Play Services before running the app that makes use of it.
A vast majority of the time, the update happens transparently and the user never knows (or needs to know) what happened. If you're withholding Play Services from your device, that is not a typical situation.

Piggybacking on what Doug said you should be checking in your app for the correct version of google play services you compiled against
GoogleApiAvailability mApiAvail = GoogleApiAvailability.getInstance();
int status = mApiAvail.isGooglePlayServicesAvailable(this);
if(status != ConnectionResult.SUCCESS){
mApiAvail.showErrorDialogFragment(this,status,1234);
}
This would show a dialog to the user saying they need to update/enable google play services.
This fixes the case where the device was not updated to the version you need.
...but it just doesn't feel right (for example the user might not have
Internet or space for an update). Will the user be forced to update
every time a new version is needed?
When you update your google play services for your app you have then declared that your app cannot function without at least that version of Google Play Services so you are forcing the user to update to be able to use your app. It is then up to the user to decide if they want to do that or not.
where is it documented that Firebase version X requires Google Play
Services version X? I cannot see anything on Firebase release notes.
Firebase is part of google play services which is why they need to be the same version

Related

android : The minimum google play service version for mobile vision ocr?

I am developing an application and using Mobile Vision Api for text recognizing.I noticed that its not working in some devices.After searched I understand that one reason is because of google play service version that is installed on user device.So I know that I can get the version that is installed on user device like this :
int v = getPackageManager().getPackageInfo("com.google.android.gms", 0 ).versionCode;
but what is the minimum version that i have to check on user device to notice to the user to update the google play service on device(if necessary)?
I think this question is related to your post here.
There seems to be no minimum GPS version specified from the Overview of Google Play Services however it is recommended you update to the lastest as:
Google Play services gives you the freedom to use the newest APIs for
popular Google services without worrying about device support. Updates
to Google Play services are distributed automatically by the Google
Play Store and new versions of the client library are delivered
through the Android SDK Manager. This makes it easy for you to focus
on what's important: your users' experience.

Getting CurrentLocation 0 using fused location when google play service is different in app and device

I am trying to get Current location using Fusedlocationservice.
In my gradle file i have put below playservice version
compile 'com.google.android.gms:play-services:9.4.0'
Now if in device have latest version of google playservice then its work well. it give proper location.
But if device have lower version then its not give current location.
Its also give warning in logcat like below:
W/GooglePlayServicesUtil: Google Play services out of date. Requires 9452000 but found 6184738
So its mandatory to have latest version of playservice in device to get current location..?
If yes then i need alternet solution for this. because every user not able to update service in device so.
my code you can see here .Get Current Location 0 in marshmallow where below 23 API its give exact current Location using fused Location
Any Help will highly appreciated.
as far as i know FusedLocation was added in Play Service 7.0 and the one you posted is 6184738 is 6.1 i guess, you can check here all the release changelog, so it should work on devices with play services 7.0 or higher
You might want to check this document: Ensure Devices Have the Google Play services APK
As described in the Google Play services overview, Google Play delivers service updates for users on Android 2.3 and higher through the Google Play Store app. However, updates might not reach all users immediately, so your app should verify the version available before attempting to perform API transactio
You are strongly encouraged to use the GoogleApiClient class to access Google Play services features. This approach allows you to attach an OnConnectionFailedListener object to your client. To detect if the device has the appropriate version of the Google Play services APK, implement the onConnectionFailed() callback method. If the connection fails due to a missing or out-of-date version of the Google Play APK, the callback receives an error code such as SERVICE_MISSING, SERVICE_VERSION_UPDATE_REQUIRED, or SERVICE_DISABLED. To learn more about how to build your client and handle such connection errors, see Accessing Google APIs.
Another approach is to use the isGooglePlayServicesAvailable() method. You might call this method in the onResume() method of the main activity. If the result code is SUCCESS, then the Google Play services APK is up-to-date and you can continue to make a connection. If, however, the result code is SERVICE_MISSING, SERVICE_VERSION_UPDATE_REQUIRED, or SERVICE_DISABLED, then the user needs to install an update. In this case, call the getErrorDialog() method and pass it the result error code. The method returns a Dialog you should show, which provides an appropriate message about the error and provides an action that takes the user to Google Play Store to install the update.
Note: Because it is hard to anticipate the state of each device, you must always check for a compatible Google Play services APK before you access Google Play services features.
Hope it helps!
I have put google play service version to 7.3 in gradle instead of latest version.
Because every user not have latest version of play service so if you put latest version of play service in application it always take null location if device have lower version play service. else user have to update play service to match application play service version.
So I have put lower version of playservice in app. build so its supports in each device which have equal or higher version.
got reference from doc. https://developers.google.com/android/guides/setup#ensure_devices_have_the_google_play_services_apk

What is minimum version of Google Play Services to use Firebase?

Background
I'm developing an app using Firebase features (Realtime Database, Firebase Messaging, Analytics, Crash Reporting and Auth [Facebook]). In my country, most of the users don't have wifi and rarely upgrade apps (including Google Play Services).
Question
As the title suggests, I would like to know the minimum version (the lowest). I'm also willing to remove some features if it will help to lower the Google Play Services version.
Do I need to check google play service version in my application code or will Firebase check for me?
Finding so far and I'm confused,
This post say min version is 9.0
This post say min version is 8.1.15
This SO question say developer no need to check Google Play Services
but, This doc say developer need to check Google Play Services
The most trustworthy site says 9.0
For a list of the libraries available for the different Firebase features, see Firebase libraries. The following features are now part of Firebase in the Google Play Services 9.0 SDK.
The current stable is 9.4.
https://firebase.google.com/support/releases

Firebase for Play Services below 9

The Background
My app is heavily dependent on Firebase. I use most of the services like Authentication, Realtime database, Storage, Analytics, Crash Reporting and more.
Everything works fine so far, but I have a doubt regarding a particular scenario.
The Problem
As Firebase was introduced in Play Services 9, what will happen to those devices who have still not updated to Play Services 9.
How will my app work on those devices as my app is heavily dependent on Firebase?
How does Firebase cater to the scenario of backporting?
Or should the developers some how check the version of Play Services and request the user to update?
How will my app work on those devices as my app is heavily dependent on Firebase?
When installing the application, it will prompt them a message saying that this app requires a higher version of Play Services. So it will work properly.
How does Firebase cater to the scenario of backporting?
Firebase needs a minimum API of 9. If the device doesn't support anything that's missing from the device, it will simply tell them, so you don't have to worry.
Or should the developers some how check the version of Play Services and request the user to update?
NO, Android does this for you.
i have edited my answer to make things a bit more clear
1. How will my app work on those devices as my app is heavily dependent on Firebase?
Android automatically checks for the play services version that is currently installed in the user's device and prompts the user to update to the play services version that the application was built with Firebase.
2. How does Firebase cater to the scenario of backporting?
Firebase explicitly outlines the latest version of play services as a prerequisite for building with it, there is no information on the docs about back porting so I don't think it is possible at the moment.
3. Or should the developers some how check the version of Play Services and request the user to update?
I wouldn't recommend this as Android already checks and pops up a play services error. However it is quite possible to check the version of play services and request the user to first update it in order to use your application, more info on this can be found on this link isGooglePlayServicesAvailable(Context)

Do you really need to check for Google Play services to use AdMob?

Google's instructions here say that if you want to use AdMob in your Android app via Google Play services you must ensure the user's device has the Google Play services APK installed. However, I'm having terrible trouble trying to get this working; and I've noticed that even if I uninstall the Google Play services updates on my phone (and don't bother checking if the services is available) my app is still perfectly able to retrieve and display ads! This is despite errors in LogCat like the following:
W/GooglePlayServicesUtil(26558): Google Play services out of date. Requires 4132500 but found 3159130
Presumably my phone still has the original version of Google Play services installed when it came out the factory. I'm just wondering whether I really need to check for Google Play services being available to use AdMob successfully. Right now it appears not. Please can someone tell me why I should bother having to make this check. Is it to handle case 4 at that Google link I gave above...?
The Google Play services APK is missing or disabled on the device, which might happen if the user explicitly uninstalls or disables it.
TL;DR - You do NOT need to check for Google Play services to use the Mobile Ads APIs.
The Google Mobile Ads offering in Google Play services is unique from most (all?) of the other libraries in Google Play services in that it CAN work without the service APK installed on the device.
If the APK installed on the device is a more recent version, the library will load the classes from the APK service and use these newer classes to request ads. Otherwise, the version of Google Play services that you compile in your app is sufficient to fetch ads.
The benefit here is that you effectively will always run against the latest version of the library when the device has the service installed. And in the case that your service version is older than the version you compiled your app against (ex: your example above) or in the case where there is no service on the device (ex: Kindle Fire), the library compiled with your app can still do the ad fetching, but you'll still have to pull in updates manually.
The logcat error you are getting is for either case 2 or 3.
Whether Admob craps out on case 4 is interesting. I suspect it will be ok because the old Admob classes ship with the GPS library so in worse case it could fall back to using their pathway.

Categories

Resources