Android check for Google Play Services APK when using GameHelper - android

Do I have to check if Google Play Services APK is available if I want to use AdMob and GameHelper (from BaseGameUtils apk). Do I have to add a uses-library tag to my manifest?
thx & regards

You don't HAVE to check for the presence of Google Play Services, but Google recommend that you do:
http://developer.android.com/google/play-services/setup.html#ensure
If you do not check, and Google Play Services is not installed, Android will prompt the user to install Google Play Services.
You do not need a "uses-library" tags in your manifest. Your project is able to access the BaseGameUtils (including GameHelper) because you set it up as a library project and reference it in your project.
See https://developers.google.com/games/services/android/quickstart for a detailed explanation of the steps required.

Related

How to add google play services to eclipce

I used to use old version of Google Play Services in my projects. But now I keep getting warnings when I upload my apps to Google Play. These warnings says that I have to update my Google Play Services.
I have the latest version of Google Play Services in SDK manager with Rev.49
In the last versions of Google Play Services, I can find the Google Play library in the following directory:
SDK --> /extras/google/google_play_services/libproject/google-play-services_lib/
But now there is no libproject/google-play-services_lib/. Where can I get the library?
Check out this answer: https://stackoverflow.com/a/37311511/8294916
Or the answer directly below it: https://stackoverflow.com/a/37356709/8294916
Hopefully you can migrate over to Android Studio, but if you're stuck with Eclipse because you're working on a legacy project, I feel for you! :(

Which dependency is required for Awareness API?

I want to check out the new Awareness API which is quite new. I’m using Play Services 9.0.2. The documentation has this example:
GoogleApiClient client = new GoogleApiClient.Builder(context)
.addApi(Awareness.API)
.build();
client.connect();
However, there is no hint which dependency needs to been added. Any idea?
I found it out: I need to upgrade to PlayServices 9.2.0 and the dependency is hidden in play-services-contextmanager. Just add those dependencies and here we go:
compile 'com.google.android.gms:play-services-awareness:10.2.4'
Please use the latest play services library, at the time I updated this answer it was 10.2.4
If you want to know the latest Dependency you can use my web tool called DependencyLookup.
Keep in mind that this library was added in the Play Services Repository v31. Make sure that you have at least that version installed in the SDK manager.
You need to add the library of Google Play services to your project.
Set up Google Play services
To access the Awareness API, your app's development project must
include Google Play services. Download and install the Google Play
services component via the SDK Manager and add the library to your
project. For details, see the Android guide to setting up Google Play
services.
Source
Set up Google Play services
To access the Awareness API, your app's development project must include Google Play services. Download and install the Google Play services component via the SDK Manager and add the library to your project. For details, see the Android guide to setting up Google Play services.
which is apparently on the same page you got your code sample from here
Most of the times the number of method references in your app exceeds the 65K limit, your app may fail to compile. So in order to mitigate this problem when compiling your app ,specify only the specific Google Play services APIs your app uses, instead of all of them.
compile 'com.google.android.gms:play-services-basement:9.2.0'
compile 'com.google.android.gms:play-services-contextmanager:9.2.0'
You will find the complete solution here:
http://xordroid.com/create-intelligent-apps-with-google-awareness-api/
Starting PlayServices v9.6.0, contextmanager has been changed to awareness
So, the previous answers won't be working.
The correct dependencies, as of v10.2.4 are
compile 'com.google.android.gms:play-services-basement:10.2.0'
compile 'com.google.android.gms:play-services-awareness:10.2.0'

Is it possible to build google play service lib only for GCM in eclipse?

I have created an android app in eclipse. When upload app in google play store,
Google has put a new option on their Pricing and Distribution page of their Google Play Developer Console that requires publishers to declare if they have ads or not. I got following warning message.
We detected Ad SDKs in one or more of your active APKs:
version: XXXXX, sdk: AdMob
If your app is serving ads, please change your ads declaration to
'Yes'. Failure to accurately declare the presence of ads is a policy
violation and may result in your app's removal from Google Play. You
can visit our Help Center to learn more.
Our app does not have ads, yet we are being flagged as having the AdMob SDK. I think it's because we are using google play service library which includes a transitive dependency on AdMob.
Is it possible to build google play service lib only for GCM in eclipse ?
If yes, then how ?
Go for android studio dude, Google play services has a separate instance for Google Could messaging and you can add it into gradle like this.
compile 'com.google.android.gms:play-services-gcm:x.x.x'
I don't have much idea about eclipse. But in android studio we can do that.
Google Cloud Messaging
com.google.android.gms:play-services-gcm:8.3.0
you can check more on Google developer Link

replacing com.google.android.gms:play-services with google-play-services.jar

I am building a google maps app on android using android studio
When I released the first version of my app, no one was able to view the google maps as google play services must be installed on the devices by users ( I cant ask people to download that in each device) so I want to embed it into my app.
I have been searching for 4 days and no luck so far
I got that google-play-services.jar library can be added to the app and by that no need for the user to install play services
I am not sure if I should use google-play-services.jar or com.google.android.gms:play-services in my android studio app.
I read in other answers that I can use google-play-services.jar into my app so I can get Google Play Services ready without the need for user to install it.
in another said that com.google.android.gms:play-services is a must in the app!
Anyway has experience in this?
Please advice.
Thanks
google-play-services.jar will only interract with installed play services on the smartphone. You can't emmbed the play service application in your apk, there's nos sense.
For peoples who want to use your application, they need to download it by the play store or maybe they already have google music or google maps on their phone, so they have play services installed.
So just add google play services in your gradle file
compile 'com.google.android.gms:play-services:(version)'

How to solve the Missing Google could messaging file from exter in android?

I have downloaded a demo project of GSM services.
For using it, I need to install a file name Google could messaging but, it is missing from my SDK.
How can I add this file to my SDK?
New To Android
If you use GCMS (Google Cloud Messaging Services), you need to build a library project which uses Play Services and import it into your work-space.
Generally:
Install the Android SDK from this link.
Download and configure the Google Play services SDK, which includes the Google Maps Android API. You can see the setting up on this link.
Don't forget to add the required Google Play services settings in your application's manifest.
When you add the Play Services library to your project, be sure to add it with resources, as described in Setup Google Play Services SDK. The key point is that you must reference the library. Simply adding .jar file to your project won't work. You must follow the directions for referencing a library, or your app won't be able to access the library's resources, and it won't run properly.
You can get the full instructions from Setting Up Google Play Services.

Categories

Resources