A backstory, history, and interesting details on Google Play Services for Android
Introduced in 2012, Google play services is an API framework provided by Google on top of Android.
Internally called GMS Core, Play Services is primarily backed up by Google servers.
Providing access to Google Drive, Google Cloud Messaging, Google Pay, Google Play Game Services as well as APKs for core background services such as GoogleOneTimeInitializer, SetupWizard, GooglePackageInstaller and many more of them, it is a way for Android Developers to get Native Android Development experience to talk to Google Backend servers and stuff that’s run by Google.
Prior to Play Services’ existence, you would go directly to Google Servers and communicate with REST APIs and do JSON parsing yourself. A lot of effort and a lot of low-level mechanisms Android Developers would struggle with.
One of the few things that Play Services made available is that you don’t have to do JSON parsing yourself, you get a nice JAVA data structure to deal with.
Another cool thing is adding Offline writes, so if you want to write something to the cloud you call API in play services and it stores in local device database for you and gets to cloud as soon as the network constraints are satisfied. If you are offline or have a bad network, play services will handle retries.
Play Services is delivered through Google Play Store, so updates to plugins or libraries can happen on regular basis and the Android Team can update the implementation details of the code on devices that do not get System Image Updates. The OS itself is not updated but only the Play Services on the fly.
What makes it to Google Play Services?
The primary goal is to put things backed by Google Services. So something like Volley, RecyclerView libraries won’t be added to Play Services as they are not specific to Google services.
How does the communication work between an Android App and Play Services?
The Android app and services run in separate processes for security, stability, and memory management reasons, but they need to communicate and share data. This is where the Binder mechanism is used.
The Play Services library primarily sets up the IPC link between your application running in your process and the play services application running in a separate process and then API calls are made that go through Binder across to the implementation running in Play Services process.
Google Play Services APIs primarily are set up to be asynchronous.
What is the MIN SDK Version for Play Services?
In 2014, the Play Services had support up to Ginger Bread, Version 9. In 2020, the support seems to be up to Jelly Bean. Older Versions of Android are locked to the last Play Services version that they support.
Exploring the case of Closed-source, OEMs, and silent updates.
Getting LG, Samsung, Xiaomi, and the other OEMs to update their devices to the latest version of Android is difficult. By the time the OEMs get the new version, port their skins over, ship a build to carriers, and the carriers finally push out the over-the-air update, users are restrained from experiencing the latest versions.
If the device isn’t popular enough, this process doesn’t happen at all. Updating a phone is a massive project involving several companies.
Since it’s really hard to push out an Android update, Google’s solution is to sidestep the process completely with Play Services.
Play Services has lots of permissions. It’s kind of a system-level process. Play Services constantly runs in the background.
Play Services has its’ own update mechanism that the user cannot control. The whole point of the Play Service update is to not let the end-user know about its’ updates.
Original equipment manufacturers are not allowed to modify the Play Services. It’s not open source as it is part of the Google package.
When you can update services without having to update a System Image, it is a win-win for end-user and Google and the OEMs.
Play Services is only available to smartphone OEMs through a license with Google, which OEMs need to apply for once they pass the Android Compatibility Test Suite and Google Test Suite on a per-device basis.
Since the inclusion of GMS and GMS Core is behind a license, and practically all major apps have grown to be reliant on Play Services and its APIs for many of their core functions, Google retains complete control of the Android ecosystem despite Android being open-sourced as an OS.
It is likely that, as an Android user, not in China, you cannot practically use Android without Google, given that you would lose out on Google Sign-in, Admob, Google Maps, nearly all Google Apps.
One of the popular alternatives though not complete replacement to Play Services is the Micro G project. It is the re-implementation of Google’s proprietary Android user space apps and libraries.
On an ending note, Google Mobile Services is a collection of Google applications and APIs that help support functionality across devices.
These apps work together seamlessly to ensure your device provides a great user experience right out of the box and this also means Google has full control over each and every Android Phone despite the open-source.
Reference:
Credits to all the articles, podcasts, documents, videos on the Google Play Services, and related topics.
Open Source:
Find us at:
GitHub:
YouTube:
Twitter: https://twitter.com/androiddevnotes
Instagram: https://www.instagram.com/androiddevnotes
Discord: https://discord.gg/HqTbjss
Contributions:
Contributions and Pull requests are welcomed at https://github.com/androiddevnotes repositories!
🐣