limitation on FusedLocationProviderApi Android - android

My app is using android.location.LocationManager to get network and gps locaitions. Due to high battery consumption. I decided to switch to FusedLocationProviderApi. I'm worried about the impact on current users. Since this api requires google play service. is there any statistics on what percentage of android devices have google play service installed? is there any other things to consider that might cause current users unable to use the app after switch?

If the user is able to access play store , the google play services are installed.
below is the play services description from play store
'Google Play services is used to update Google apps and apps from Google Play. This component provides core functionality like authentication to your Google services, synchronized contacts, access to all the latest user privacy settings, and higher quality, lower-powered location based services. Google Play services also enhances your app experience. It speeds up offline searches, provides more immersive maps, and improves gaming experiences. Apps may not work if you uninstall Google Play services.'
https://android.stackexchange.com/questions/97145/get-rid-of-google-play-services
https://android.stackexchange.com/questions/104842/is-it-safe-to-uninstall-google-play-services-app

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.

What is the difference between Google Service Framework(GSF)&Google Mobile Service(GMS)?

I am learning Google Cloud Message recently, it requires both GSF and GMS(which new name is Google Play Service, but not that Google Play app).
I decompile the code of both, but I don't know the usage of them, and don't know why Google provider these two services, why not one? And what's the difference of them?
I think it would be good to define them first:
-Google Mobile Services (GMS) is a collection of Google applications and APIs that help support functionality across devices. Samples are Gmail, Chrome, Google+, Google Maps and Youtube.
-Google Play Services(Google Service Freamwork) is used to make sure that everything is running smoothly on your device.
It takes care of the following:
1.Google Backup
2.Play Store Services
3.Contacts Sync
4.Account Manager

Android App Google Play Services Battery Drain

When using Google Play services API for location and In App Billing request, does the associated Battery/CPU/Wifi/Network usage show up under battery stats under Google Play Services or under the App's Name ?
To my experience OS always shows usage under the associated app's name.
However I have a user claiming that my app causes Google Play Services battery drain with 8-10% on his Nexus 6P when my app does not even show up on his battery stats at all.
Is this somehow possible ?

Google Play Services availability and Google Play

We developed an application that uses the Google Play Services extension.
I assume that people without Google Play Services installed on their device side will not be able to use these services.
However if people does not have Google Play Services installed on their device, they probably cannot download it in the first place, because they dont have Google Play App itself.
So is it safe to assume that most people who install the app have Google Play Service installed and make a more general verification in our app for other rare cases?
For example, check if Google Play Services availability and if not installed, simply write a message and exit the app.
What is your opinion on that ?
Thanks
One of the things that can happen is that Google Play Services is present on the device, but not up to date. Or the user could have disabled Google Play Services. In both these cases connection to Google Play Services will fail, so you really have to check for it, no excuses :)
The answer can be found on Android's developers website
Important: 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. For many apps, the best time to check is during the onResume() method of the main activity.

Google Play services: How to handle devices that do not have Google Play?

Google Play services is an Android library whose goal is to provide:
OAuth 2.0 authentication
Google+ sign-in
Google+ +1 button
various other goodies
If I were to use it (for instance because I want Google+ sign-in), what would happen to users whose device does not have Google Play? (Nook, Cyanogenmod, China Mobile, old devices, maybe Huawei?, etc)
QUESTION: Will my app become incompatible with such devices? Will it be displayed as compatible but then crash, or not work?
Is there a best practice to keep this in mind when using Google Play services?
GooglePlayServicesUtil.isGooglePlayServicesAvailable(android.content.Context)
is deprecated!
Use:
GoogleApiAvailability api = GoogleApiAvailability.getInstance();
int code = api.isGooglePlayServicesAvailable(activity);
if (code == ConnectionResult.SUCCESS) {
// Do Your Stuff Here
} else {
AlertDialog alertDialog =
new AlertDialog.Builder(activity, R.style.AppCompatAlertDialogStyle).setMessage(
"You need to download Google Play Services in order to use this part of the application")
.create();
alertDialog.show();
}
If the feature from Google Play Services is essential for your app there would be no way to get your App working.
You can check if the services are enabled from within your app with GooglePlayServicesUtil.isGooglePlayServicesAvailable(android.content.Context)
which returns ConnectionResult.SUCCESS if Play Services is available.
You can now try to convince the user to install it (if possible) or disable the feature that is using the service.
As the Google Play Services is not a feature declared in the manifest your app should install fine on any device but may crash later on if you are using the APIs without checking if they are available.
You can try the behaviour with the emulator. Just create an AVD without the Google APIs and put your App on it.
As others stated, your code should ideally check for Google Mobile Services. If you don't, it will crash with a java.lang.RuntimeException wrapping android.content.ActivityNotFoundException because you'll be invoking a function on a non-existing activity.
Good apps don't crash but instead spam users with notifications in all the places they rely on on play services as other answers suggested. If possible send only a single notification to users instead of spamming them with the same notification in every place you rely on play services - or close the app after a dialog explaining why it's closing.
Better apps (e.g. Signal) contain alternative logic for handling things like notifications without making play services a hard requirement.
To which degree you can make your app work without play services is almost entirely up to your use case. If you use Firebase for instance it will be very hard to make your app work without GMS.
In most cases it's possible to avoid GMS, in some cases it's maybe not the best idea (e.g. allowing users to use arbitrary location on a dating app).
Try searching for alternatives before you lock yourself in though: OpenStreetMap will work on more devices than Google Maps, it's not as complete as Google Maps in some regions though (it's good enough for picking a delivery location though).
The recommendation that you use GMS comes from Google. I'd personally recommend you to support more devices, vendors and OSs if it doesn't require doubling your code base.
If you are somehow required to use Play Services, or if you maintain a legacy app that makes calls to Play Services, then I would recommend this strategy:
On app start, check whether Play Services is available or not
If not available, redirect Play Services calls to microG
microG is an open source implementation of Google Play Services.
It lacks many features, but is under active development. Many features are still stubs.
For location services, there is also LOST, a drop-in replacement for the Google Play services location APIs.
You app might not work perfectly, but at least it is better than crashing.
Of course, the best is to NOT use Google Play Services, from the start.
If your app uses GMS features like Google Sign-In or Firebase Cloud Messaging, it won't work well on the devices that don't have GMS.
It's recommended that you use GMS if a device supports GMS; otherwise, use HMS (Huawei Mobile Services).
Please refer to the following links:
To check whether GMS is available
HMS Overview
HUAWEI Account Kit
So you can use Google+ Sign-In on the devices where GMS is available; otherwise, use HUAWEI Account Sign-In.

Categories

Resources