this might seem like a very stupid question to you, but I haven't found any answer to it yet.
In Android, there are two possibilities of making the application location aware. a) with the Android Location API or b) with the Google Play Services API. It is recommended to use the Google Play Services API since it's less battery draining and provides more accuracy.
But what if I only wanted to use GPS? No additional accuracy by combining some mobile data etc. Just plain GPS without having any internet connection. Is it still preferable to use the Google Play Services API? Also, does it require internet connection at some point? The onConnect() method is supposed to be called when a connection to the GoogleApiClient is established. Does that mean that a connection to a Google Server is needed or only that the locally saved Google Play Services (on the device) is connected to?
Related
I am confuse between both of them which one is the best GoogleApiClient or FusedLocationProviderClient. Some people use GoogleApiClient and some use FusedLocationProviderClient.I am confuse between both of them which one is the best I am beginer i am very confuse please help me.
You can use the GoogleApiClient ("Google API Client") object to access the Google APIs provided in the Google Play services library (such as Google Sign-In, Games, Drive and Location also). So in order to get the location, one first needs to connect to google play services which requires you to write some boiler plate code to manage the connection and can sometimes result in error. Even if you are not using location services, you need to connect to google play services.
FusedLocationProviderClient provides improved and simpler apis to provide location functionality to your app with the help of just a listener. It handles the connection by itself. The new API will automatically resolve certain connection failures for you, so you don't need to write code that for things like prompting the user to update Google Play services.
I've read many good comparisons between Android's framework location API and the Google Play Services Location API. However, is there any benefit in using (exclusively to obtain location) the Google Play Services Awareness API over the Google Play Services Location API?
It really depends on your exact use case & requirements.
If you just need to know the location or want to receive locations updates regularly, go with the LocationServices.FusedLocationApi.
If you have more complex, contextual requirements, for example you need to know when a user starts walking, or when a user enters an area, or something else that is based on the context of the user, you want to use the Awareness API.
To answer your question
However, is there any benefit in using (exclusively to obtain location) the Google Play Services Awareness API over the Google Play Services Location API?
No, none at all. The Awareness API was not created exclusively with the purpose of obtaining locations. LocationServices.FusedLocationApi was however, so use that.
I am looking to use the Google Play Service ActivityRecognition API as part of an Android app which will be offline for most of its usage; users will generally be out and about and a data connection is not guaranteed.
Looking at the docs, the requestActivityUpdates method requires a connected GoogleApiClient.
My question is, is the Activity Recognition API guaranteed to work if there is no data connection present?
Sure it works without data connection.
Google Play services is basically the background app that is running in the Android OS. Thus by requesting connection to GoogleApiClient you are connecting to this Google Play services app.
It is said that Google Play services apk does silent updates, however it is better to check if it is updated to the latest version, since sometimes services fail to update (happened with me only on Android 2.3).
What I am reading about play services is that it uses an API key, which implies it must have Internet access to work. Is this true?
The application I am working on must work without Internet access.
There are many pieces to the Play Services SDK. Some require API keys (e.g., Maps V2). Some do not (e.g., the fused location API).
The application I am working on must work without Internet access.
Then you are going to need to limit yourself to portions of the Play Services SDK that do not require an API key and do not have an intrinsic need for Internet access. I do not know if the fused location API needs Internet access to be useful.
It turns out initializing your code with the API-key does not require Internet access. So I can use the google libraries for GPS in my app and not worry about having a data plan.
Im new to the forum. Ive searched it, but not found any conclusive answers to my question.
Im building a location based app. Ive just started it. Im reading about how to get location based data. I am aware that not everyone uses GooglePlay. My first question is:
Do you need to be connected to Google Play to access the location services of your device?
get location without google play services -android
The above thread mentions using LocationManager without using LocationClient, (Im still getting to grips with these terms!)
I want my app to be as accessible as possible to all users, hence the question.
Thanks
John
You need google Play to access Google Maps API. If you want to be accessible to all users, it's okay because you might be publishing it on Google Play and almost every users have Google Play adjusted.
You do not need Google Play to receive location updates, however it may be required if you'd like to use i.e. Fusy Location Provider (which is part of Google Play Services).