I have an Android phone. This is, in my opinion, vastly superior to the other major alternative of having an Apple phone, for a variety of reasons which could fill an entire other blog post. However, there are some downsides - primarily, the major one is having to rely on Google Play Services to provide a whole bunch of useful functionality, like push notifications.
Google Play Services is a background application that is installed on nearly all Android devices. It has essentially all the powers possible (being a system app); it can install, remove, and update applications, as well as having access to your location, phone storage, usage information, and a whole bunch of other stuff. There’s a good reason for this; Google Play Services provides a whole bunch of useful services1 to Android applications, such as Google Cloud Messaging (GCM), Google Account single sign-on, assisted location information, and more. It’s also a necessary component of the Google Play Store2, the main appstore for Android, without which making full use of a phone is somewhat hard3.
Apart from being very powerful (and very closed source), Google Play Services has another major flaw: it massively drains your battery sometimes. This seems to be a common issue (Google it), but with a variety of ultimately unhelpful (in my experience) solutions. It would be nice if we could just get rid of the damn Google Play Services! However, I essentially want to have my cake and eat it; I want all the benefits of Google Play Services, without any of the battery drain & Orwellian stuff.
Thankfully, there’s a way to do this. The microG project is, as they state on their website, “a free-as-in-freedom re-implementation of Google’s proprietary Android user space apps and libraries.”. This sounds like (and is) exactly what we want: we get most of the Play Services functionality, but the code is open source (so we’re reasonably sure that it’s not going to eat our lunch) and I’m willing to bet it’s somewhat easier on the battery, as well. (Spoiler alert: it is…by quite a large amount!)
What’s the catch?
Of course, there’s always a catch. In this case, the catch is that not everything works yet. The things I care about work - that is, Google Could Messaging and authentication with a Google Account - but not much else works, or it’s somewhat flaky. Have a look at their Implementation Status page: essentially, the following things you might care about won’t work:
- Android Wear support
- Google Plus (although I’m pretty sure that’s not a big loss for anyone, really…)
- Mobile ads (hah)
- Google Play Games
- Google Drive
- Google Fit
- Google Cast
- Android Auto
You also won’t be able to use the Google Play store, unless you use an alternative client, like the Yalp Store - which works great, but doesn’t (and will never) let you actually purchase anything; only free apps are supported. I, personally, am alright with this tradeoff.
Okay, so how do we install it?
Ideally, you’d start off with a clean ROM, then install the microG .apks as described in their Installation guide.
That would be the reasonably sane way to do it. Unfortunately, I’m a stubborn bastard, and I don’t
feel like reflashing my phone & losing all of my data in the process. So, I did it the slightly
insane way - deleting my phone’s
/system partition, then reinstalling my ROM (!). In theory, this works,
because all of your user data is on a separate partition. In fact, it did work in my case. (Your mileage may vary, however.
If you break your phone because of me, don’t yell at me.)
Essentially, the steps I followed went somewhat along the lines of:
- Ensure you have the
.zipfile you used to install your current ROM handy. I’m using LineageOS, and I still had the file on my SD card, so it was good. You might also be able to just apply a ROM update
.zip, then use that in lieu of your original install
.zip. You’ll also need some way of getting root - I personally use Magisk.
- Reboot into recovery, and take a nandroid backup of your
/systempartition (and your data partition if you’re really paranoid) Unexpected bad things will happen if you don’t do this, because it might all go south and you’ll have to reinstall anyway!
- Here’s the sketchy part. Now, wipe your
/systempartition (and only your
/systempartition!) in recovery mode.
- Flash your install
.zip. Hope it works. If you get an error, better restore your
/systembackup and give up. Wiping your Dalvik/ART cache wouldn’t be a bad idea, as well (although your installation zip may already have done this for you).
- Reboot, and pray. If you’re lucky, it’ll boot. It might take a while, though, because it’s as if it’s booting the system for the first time again.
- Reboot into recovery again and get root.
- Reboot into Android. Go to the microG downloads page and download the latest NIGHTLY version of “Services Core” and “Services Framework Proxy”. The nightly versions are the only ones which work - if you get stable, you’ll potter around for ages wondering why things are broken before it clicks, like I did.
- Uninstall all the actual Google stuff that’s still lying around on your phone. I used Titanium Backup to do this, by just searching for things with “google” in their package ID.
- Configure signature spoofing, by consulting that linked guide (if your ROM doesn’t support it already, that is). I installed the Xposed Framework, obtainable from here, then installed FakeGApps with Xposed.
- Follow the actual microG installation guide, using the two
.apks you just downloaded. With regards to a Play Store app, I personally found that installing FakeStore and then just using the mighty Yalp Store from F-Droid worked a treat.
- Sign into Google in the Android account settings.
- Die Ende! Actually, wait, no, there’s more.
Post-installation teething problems
GCM is broken
Despite all my yelling about Google Cloud Messaging (GCM) working under microG, I noticed at first that, in actual fact, no apps appeared under the GCM panel in microG settings, and I didn’t get any notifications! It turns out that GCM registration (the process which allows apps to actually use GCM) only happens when apps get installed (or updated, in some cases). So, to get GCM to work with your new microG install, you need to update/reinstall all the apps which use it. Titanium Backup helps for doing this in a way that preserves your data.
I can’t use Google Calendar or Contacts any more!
This is annoying. Fortunately, it’s fixable, but requires you to install some proprietary Google stuff.
For Google Calendar, download & install a copy of Google Calendar Sync, then install the official Google Calendar app from the Play Store/Yalp Store (in my case). That should make stuff work again.
For Google Contacts, I had to follow this guide, using DAVdroid to sync the contacts over. It’s annoying to have to install another app, but it works, and I couldn’t do it any better, so [shrugs].
So, there you go - a recollection of how I performed a slightly insane Google Play-ectomy, without reinstalling or losing any data. Hopefully this was somewhat helpful, or informative, or interesting. At the very least, it’s a blog post, and I haven’t done these in ages. (This will change, I think.) So, there’s that.