Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Cloud Messaging for Android library vs. Google Play Services

Current Google GCM documentation requires you to install Google Play Services and to use them for GCM (Google Cloud Messaging). The library is 1.1MB, yet my current .apk is half that size. My app is intended to receive GCM and display some data on the screen, so I don't need Google Play Services' Maps API, G+ login, etc. Nor I need to be able to respond back to the server after getting GCM.

SDK Manager allows download and installation of standalone Google Cloud Messaging for Android package. It is the one that was used before Google I/O 2013, where Play Services were announced.

My question is: what is the difference in performance between GPS's GCM and standalone GCM for Android? Do I really have to switch to GPS? Is standalone GCM depricated? Can I still receive data (up to 4K) with standalone GCM?

like image 471
Xeos Avatar asked Aug 27 '13 19:08

Xeos


People also ask

What is Google Cloud Messaging used for?

Google Cloud Messaging (GCM) for Android is a service that allows you to send data from your server to your users' Android-powered device and also to receive messages from devices on the same connection.

Is Google Play services necessary for Android?

Google Play services helps to ensure the security and reliability of an Android device, and keep devices updated with the latest security features. This includes: Google Play Protect, which can warn users if an app contains known malware.

What do you use Google Play services for?

Google Play Services connects apps to other Google services, like Google Sign In and Google Maps. Google Play Services isn't the same as the Google Play Store app, and is included with Android. Google Play Services doesn't make your battery drain faster or use too much of your mobile data plan.

What is Android Service library?

What is it? It is a client-side library from Google, using which app developers can use the latest services supported/provided from Google on Android devices. It also takes care of authentication flows required to use such services.


3 Answers

As far as I know, yes, the old one is deprecated (it says so here http://developer.android.com/reference/gcm-packages.html), but still works.

I would recommend using the Play Services version, though, since it's MUCH easier to configure and use, and if you don't need G+ login or anything else you don't have to use it. Yes, your APK will be a little bit bigger, but I think it's worth it.

Plus, any new features or improvements to the protocol will most likely be only for the Play Services library, and not for the old one.

like image 93
luthier Avatar answered Nov 10 '22 12:11

luthier


The old GCM though deprecated, still works. And there is a probability it will be working for some more time. Personally, I implemented the new GCM using the play services and it seems to be buggy as there were devices that could not get the registration ID and got the SERVICE_NOT_AVAILABLE error. So after some research I wasn't able to find a solution for it, and reverted to the old GCM method that uses GCMIntentService, and I was able to get back the registration IDs. Bottom Line : Seems you can use the old GCM method for the time being.

like image 41
tony9099 Avatar answered Nov 10 '22 10:11

tony9099


You don't need to worry much about increase in app size while using GCM using Play Services as long as you're using Proguard.

Description of The Google Play services client library mentions

The client library has a light footprint if you use ProGuard as part of your build process, so it won't have an adverse impact on your app's file size.

I haven't myself measured the difference in apk with the two different approaches. Will update if I do.

like image 1
Atul Goyal Avatar answered Nov 10 '22 10:11

Atul Goyal