Android is an open source software stack for a wide range of mobile devices and a corresponding open source project (Android Open Source Project - AOSP
) led by Google.
When you buy an Android phone, AOSP
also comes with Google Apps
such as GMail
or GMaps
on top of it. Those apps contain proprietary code that we don't have access to and that rely on Google Play Services
API, which is also installed as system apps (therefor it has full permissions over the system). Like any proprietary app you have no idea what it might be actually doing on your back. That's a problem, to me.
If you want pure AOSP
you'll have to install one the many ROMs [1] available and compatible with your device. I'm using Omnirom on a Nexus5. You could choose to use only open-source apps from F-Droid along with a pure AOSP
based OS. You can be sure the apps you're getting from this repository are not relying on Google Play Services
because it is the choice of this great community.
But one day you want or 'have to'.. use a proprietary app from Google Play Store
... It is my case. For example, my company is using Slack as an internal communication tool. Slack comes as a proprietary application that is only downloadable on Google Play Store
and it relies on Google Play Services
. So now, I guess you get the picture.
On top of that, more and more developpers are adding dependencies to Google API in their apps.. whether is it by comfort or NIWID or is it a business requirement. A good example is Play Games Services
that provides many API to save game data online, understand how players interact, 'socialize' games... That are many services that are used to acquire and engage users... at the expense of privacy.
You are reading this article because you have something to hide and say. You would like to free your android OS from Google. So, Welcome.
µg Project
MaR-V-iN
started developing what he named the NOGAPPS
package - a set of applications and frameworks with the goal to fill the gap of missing gapps package. This project is now continued under the name µg Project
.
The main idea of this project is to build a free replacement for all proprietary parts by Google injected into the Android ecosystem. This is mainly two components these days, both called Play Services
: the client library play-services, that is injected into applications by their developers and GmsCore
, the service component used by this library. Play services
includes more or less all newer proprietary Android features.
I will try to cover the main parts of it. I say "try" because it's rough and complex... and I'm not an Android developer. I might say shit or forgot information, so this article will be/is regularly updated as I'm learning about the project.
Geolocation
Currently, Android has two APIs for geolocating [2]. One of them being the open source Location API that is implemented by UnifiedNlp
, the other one is the proprietary Play Services Location
API.
UnifiedNlp
alone does not provide any features, but acts as a middleware for multiple backends. All of them can be downloaded and updated using F-Droid
.
Here is a list of backends for geolocation and (reverse) geocoding available:
AppleWifiNlpBackend
- backend that uses Apple's service to resolve wifi locationsOpenWlanMapNlpBackend
- backend that uses OpenWlanMap.org to resolve user location.OpenBmapNlpBackend
- backend that uses openBmap to resolve user location.MozillaNlpBackend
- backend that uses the Mozilla Location Service to resolve user location.PersonalWifiBackend
- Local location provider for WiFi APs using on-phone generated database.LocalGSMLocationProvider
- Local opencellid based location provider backendLocalGSMBackend
- Local location provider for gsm cells with separate database file (lacells.db)NominatimGeocoderBackend
Install instructions:
Dedicated XDA thread:
Screenshots:
One more thing, this middleware is included [3] as a component in µg GmsCore
, that I'm writing about in next chapter.
Using apps requiring 'Play Services' APIs
Here is a small list of things you may encounter when you don't have the Google Play Services
:
- Some apps do not install because of missing Google Maps API.
- Some apps fc (force close) at startup bacause of missing Maps API or Play license check issues.
- Some apps hardcoded links to several Google Apps and therefor fc or react unexpectedly in certain cases.
Here comes µg GmsCore
. This app provides an implementation of some Play Services
.
Currently the main developer focuses his development only on the portions of play services that are used a lot:
LoginService
: Allows you to login to a Google account (OAuth)Google Cloud Messaging
:GCM
(that replacesC2DM
) is a push notification service that is running in background on your phone. It listens for messages, stored by apps using it, in Google'sGCM
servers. For this to work, your device needs to be checked-in so that apps can know for which Google account they must send their messages.Play Services Location API
. See [2]Maps API (v2)
: Translates calls toGoogle Maps API
into calls to OpenScienceMap. Displays a map thanks to a lib developed within theOpenScienceMap
project.
Requirements:
- Your pure
AOSP
ROM needs to support µg package signature faking. It is the case inOmnirom
(https://gerrit.omnirom.org/#/c/8672/ + https://gerrit.omnirom.org/#/c/13136/) and it's coming soon inCyanogenmod
(http://review.cyanogenmod.org/#/c/106162/).
Download:
- Fresh builds are available here: http://files.brnmod.rocks/apps/GmsCore/Latest/. Get
play-services-core-debug.apk
. - F-Droid: still pending approval. See https://f-droid.org/forums/topic/android_packages_apps_gmscore/
Usage:
- This app creates an account provider named
Google
. You can setup it with a google account. - Once logged in,
µg GmsCore
proceeds to device checkin, unless you disabled it. It creates an unique identifier for Google services and strips identifying bits other than your Google account name from this data.
For some reasons, it can happen that checkin expires. Here are some independant tricks you can use to force new device checkins:
- Compose
*#*#2432546#*#*
(which stands for*#*#CHECKIN#*#*
) - If you don't want to dial or can't because there is no dialer on your device, use an
ADB
shell as root and type this:
# am broadcast -a android.provider.Telephony.SECRET_CODE -d android_secret_code://2432546
- Or... you can just kill/restart
µg GmsCore
's process. OS Monitor can help you to do so.
Screenshot:
Getting apps from 'Play Store'
There are many solutions to get applications (APK) without having Google Play Store
installed. However most of them rely on alternative markets, or you have to get APKs from a program installed on your computer.
The solution I would like to write about is Blankstore
. This app allow you to get apps from Google Play
directly on your phone. The development on BlankStore
was stopped. Latest commits are just maintenance fixes, but it still works even on android 5.1.
- Code: https://github.com/mar-v-in/BlankStore
- Builds: https://github.com/mar-v-in/BlankStore/releases
- Instructions: http://forum.xda-developers.com/showpost.php?p=29115263&postcount=84
- Blankstore must be installed as a system app. Some time ago, I wrote an article teaching how to make a flashable zip out of it: how-to-create-your-own-flashafterupdate-zips-for-android.html
This project of doing an unofficial Google Play Store
client was planned to be continued into Phonesky but it looks like it is now abandonned.
Screenshot:
Final words
µg Project
is demanding a lot of work and talent as you have to be able to reverse engineer what Google do in its proprietary code/API. You also have to adapt in case of changes.
Some time ago I asked MaR-V-iN
how he proceeds, here is his answer:
I mostly don't decompile, but I use class inspection (javap) and once I derived the interfaces enough I catch the calls done on them. Only in some rare cases I use decompilers (especially as they don't provide much usable information beside the things already retrievable using class inspection). I use dex2jar, so that I can use traditional java tools on android code.
You can have more information about this project in those links: http://forum.xda-developers.com/showthread.php?t=1715375 + https://github.com/microg
Don't hesitate to contribute to this project whether by providing helpful bug reports or by writing code. You can also donate (requires to be logged to view full profile details) to MaR-V-iN
to encourage him to continue his great work.
Finally I think we need to "educate" android developers not to add requirements to Google Play API when it is not necessary... especially if they want to keep support with non-Google Android-compatible systems (AOSP, Amazon, Nokia, Sailfish OS, ...).
[1] | An AOSP ROM is like a GNU/Linux distro but it is not as 'free' as it - most of the time - contains proprietary blobs to support the hardware. Qualcomm, I'm looking at you. An example for my device. |
[2] | (1, 2) More information here: https://github.com/microg/android_packages_apps_UnifiedNlp/issues/36#issuecomment-86744484 |
[3] | As a side note, you can see they share the same namespace com.google.android.gms so you can't have both installed (and you don't need it anyway). |