Google Play Services 9.2.0 Selective Compile Awareness API - android

I'm trying to use the new Awareness API in an app but the only way that I can include it in my code is by using
compile 'com.google.android.gms:play-services:9.2.0'
in my gradle file.
I tried using
compile 'com.google.android.gms:play-services-awareness:9.2.0'
but it doesn't seem to exist.
Does anyone know what the correct compile path for selective compile of the awareness API is?
Thanks in advance.

It actually does exist.
//Awareness API
compile 'com.google.android.gms:play-services-contextmanager:9.2.0'

Today you have to include:
compile 'com.google.android.gms:play-services-awareness:10.2.4'
If you want to know the latest Dependency you can use my web tool called DependencyLookup.

Related

Does "play-services:9.8.0" include "play-services-location:9.8.0"?

I am upgrading an App, and in my build.gradle file, I have this:
dependencies {
..........
compile 'com.google.android.gms:play-services:9.8.0'
..........
}
In the Android SDK Setup Quickstart Guide Urban Airship provides, they offer this as a sample code:
dependencies {
..........
// Recommended for location services
compile 'com.google.android.gms:play-services-location:9.8.0'
..........
}
If I use "play-services:9.8.0" I would assume it would also include "play-services-location:9.8.0" because "play-services-location:9.8.0" should be a subset of "play-services:9.8.0", but I wanted to confirm. Do you know if this is a correct assumption? Thank you.
From Google Api Documentation
you can use the latest Google play service api:
dependencies {
compile 'com.google.android.gms:play-services:10.2.1'
}
If the number of method references in your app exceeds the 65K limit, your app may fail to compile. You may be able to mitigate this problem when compiling your app by specifying only the specific Google Play services APIs your app uses, instead of all of them.
To Selectively compiling APIs into your executable:
compile 'com.google.android.gms:play-services-maps:10.2.1'
compile 'com.google.android.gms:play-services-plus:10.2.1'
compile 'com.google.android.gms:play-services-location:10.2.1'
compile 'com.google.android.gms:play-services-games:10.2.1'
compile 'com.google.android.gms:play-services-gcm:10.2.1'
the detail lists are provided in the documentation.
Yes, play-services is the full bundle. They were broken apart to reduce the method count of your app so you don't hit the dex limit. More information can be found here.

How do I identify and import only specific libraries from Google Play Services?

I currently have the following line in my dependency:
compile 'com.google.android.gms:play-services:4.2.42'
I put this in longn back when I was just starting out to code my app and now I realize that this is what is probably causing my app to bloat at about 20 MB
Is there a way to identify and specifically import only necessary services to reduce my app size? I am pretty sure there are ways to import only specific modules, but also pointers on how I can identify which modules I need will be appreciated
From version 6.5, you can instead selectively compile Google Play service APIs into your app,
For example, to include only the Google Fit and Android Wear APIs, replace the following line in your build.gradle file:
compile 'com.google.android.gms:play-services:8.4.0'
with these lines:
compile 'com.google.android.gms:play-services-fitness:8.4.0'
compile 'com.google.android.gms:play-services-wearable:8.4.0'
please check this link
First, you need to check your project & identify which Play Services Modules are used. Then, You can selectively add the play services APIs which are necessary to your project.
For Ex : The below will be add Google Analytics and Maps modules to your app.
dependencies {
compile 'com.google.android.gms:play-services-base:8.4.0'
compile 'com.google.android.gms:play-services-analytics:8.4.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'
}
You can use something like this
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'

PlaceAutocompleteFragment can't resolved

In my app I have added Google Maps and they work fine. I want to add a PlaceAutocompleteFragment. I am using the key which I had already generate for maps and I have enable the option Places Api from google.console. I have added these to my build.gradle:
compile 'com.google.android.gms:play-services-maps:8.3.0'
compile 'com.google.android.gms:play-services-location:8.3.0'
compile 'com.google.android.gms:play-services:8.3.0'
but when I try to use PlacesAutoCompleteFragment then Android Studio can't resolve this.
The problem here is that PlaceAutocompleteFragment didn't exist in version 8.3 of Google Play Services.
This isn't documented very well, but you can see on this blog that PlaceAutocompleteFragment was "announced" in December 2015.
You can also see in the PlaceCompleteFragment Google code samples on GitHub that they are using version 8.4 of GooglePlayServices.
I also had this problem, and updating Google Play Services is what made it work.
So, update Google Play Services in the SDK Manager, and then modify the build.gradle like so, and it should work:
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
Update
In newer versions of Google Play Services, they have broken out the Google Places API, so you need to include it in addition to Maps and Location:
compile 'com.google.android.gms:play-services-maps:11.0.2'
compile 'com.google.android.gms:play-services-location:11.0.2'
compile 'com.google.android.gms:play-services-places:11.0.2'

What is the gradle compile dependency for Locating Longitude and Latitude?

I want to just import into my project the dependencies from GoogleApi to use location to get longitude and latitude.
I was trying to follow this tutorial which they recommend to use the FusedLocationProviderApi, but they use eclipse, so I'm using android studio and I just want to add the dependencies for that library.
I know that if I include compile 'com.google.android.gms:play-services:7.5.0' in my build.gradle it will include all services I only need those for locating long and latitude, I don't want to use compile 'com.google.android.gms:play-services:7.5.0' because I want to keep my methods count low.
UPDATE:
When trying to include:
compile 'com.google.android.gms:play-services-location:8.0.0'
compile 'com.google.android.gms:play-services-maps:8.0.0'
I get
UPDATE 2
Got it working with: compile 'com.google.android.gms:play-services-location:8.1.0'
Use play-services-location instead of play-services.
Note, though, that for inexplicable reasons, play-services-location depends upon play-services-maps, at least for version 8.1.0. So, you will be pulling in the Maps V2 code as well.

which Google Play services API contains com.google.android.gms.appstate.AppStateManager?

I am using google play services API, and from old version of code, i included the whole library. Now i want to use Selectively compiling APIs from this link https://developers.google.com/android/guides/setup. But i can't find what does com.google.android.gms.appstate.AppStateManager come from .
I already have this
compile 'com.google.android.gms:play-services-base:7.5.0'
compile 'com.google.android.gms:play-services-identity:7.5.0'
compile 'com.google.android.gms:play-services-ads:7.5.0'
compile 'com.google.android.gms:play-services-games:7.5.0'
compile 'com.google.android.gms:play-services-plus:7.5.0'
but none of them have.
Please help.
The AppStateManager of the Google Play Services is DEPRECATED, so they have hidden the AppState play-services-dependency.
At the moment you can still get it via the following dependency, but it will probably get deleted soon.
compile 'com.google.android.gms:play-services-appstate:7.8.0'
or for Updated version use
implementation 'com.google.android.gms:play-services-appstate:8.4.0'
Add the following dependency in build.gradle rember this is for old DEPRECATED
compile 'com.google.android.gms:play-services-appstate:9.0.0'
This is work for me

Categories

Resources