Episode 27

The mystery of Google Play Services: Android's black box

Published on: 4th October, 2022

On this episode of Android Bytes, we take the wraps off Google Play Services, the wonder app that powers many features and APIs you probably thought were native to Android.

What does Google Play Services do and how does it do it? Why is it so important and what happens when it's missing from your device? We spoke with German developer Marvin Wißfeld to find out. Marvin is the creator of microG, a "free-as-in-freedom re-implementation of Google's proprietary Android user space apps and libraries" for devices running AOSP.

  • 02:59 - What is Google Play Services (GMSCore) and how is it delivered to Android devices?
  • 04:14 - What are some of the features powered by Google Play Services?
  • 07:27 - What are the most commonly used APIs provided by Google Play Services?
  • 08:23 - How do Play Services' location APIs (Network Location Provider [NLP] and Fused Location Provider [FLP]) work? Why do many apps use Google's location APIs?
  • 11:20 - What advantages do apps have in using Google's Firebase Cloud Messaging (FCM) over alternative push notification APIs?
  • 13:28 - How are push notifications handled in the Chinese market where Google services are banned?
  • 18:07 - How do apps tend to behave on devices without Google Play Services?
  • 23:02 - What is microG and how does it help work around some of the issues with running apps on AOSP?
  • 26:40 - How do users install microG and why is signature spoofing needed?
  • 31:00 - How does the modular nature of Google Play Services optimize its app size?
  • 34:57 - Have any Google APIs eventually made their way to AOSP?
  • 36:43 - Are there any Google APIs that work on AOSP?

Android Bytes is hosted by Mishaal Rahman, Senior Technical Editor, and David Ruddock, Editor in Chief, of Esper.

Esper enables next-gen device management for company-owned and managed tablets, kiosks, smart phones, IoT edge devices, and more.

For more about Esper:

Our music is "19" by HOME and is licensed under CC BY 3.0.

Transcript
Mishaal:

Welcome to Android bites, powered by Esper, the podcast diving

Mishaal:

deep into the world of Android.

Mishaal:

I'm your host, Michelle Ramon.

Mishaal:

My co-host David Ruddick was unable to make it this time.

Mishaal:

So you'll be hearing even more from me this time around.

Mishaal:

Fortunately, we've got a great topic and guest I've been wanting to

Mishaal:

talk to for a very, very long time.

Mishaal:

We're finally dedicating an episode to talking about Google place

Mishaal:

services and that it's so complicated.

Mishaal:

It's basically Android's black box.

Mishaal:

This one app powers.

Mishaal:

So many different features, people think are actually part of AOS

Mishaal:

P and provides so many crucial APIs, which many apps depend on.

Mishaal:

It's a single biggest differentiator between AOS P and GMs, Android, and

Mishaal:

is both how Google is able to provide so many different features, services

Mishaal:

and APIs across Android devices, as well as lock those devices into their

Mishaal:

ecosystem that lock in is something today's guest takes issue with.

Mishaal:

On today's show.

Mishaal:

I'd like to introduce Marvin Feld, the principal maintainer of MicroG a

Mishaal:

free and open source reimplementation of Google place services.

Mishaal:

Welcome to the show, Marvin.

Marvin:

Hi, thanks for the introduction Rashi.

Mishaal:

Yeah.

Mishaal:

So before we dive into this topic, I wanted to ask you to

Mishaal:

tell us a bit about yourself.

Mishaal:

What do you do right now?

Mishaal:

And how did you get your start in?

. Marvin:

Right now I'm basically an open source developer.

. Marvin:

, my main job is really open source development.

. Marvin:

I'm also freelancer for allowing me to , get some more income so that I,

. Marvin:

can focus on open source development, which is not that well paid.

. Marvin:

And I'm mostly working on two projects.

. Marvin:

MicroG which you just mentioned and Dino, which is an instant messaging app, and

. Marvin:

yeah, in the development I started, I think around 2011, I got my first standard

. Marvin:

Android phone which was a HTC desire HD in case anyone remembers that device.

. Marvin:

And yeah, I seen begin thinking with it and playing around and , things like that.

. Marvin:

And yeah started also developing , first steps at that time.

. Marvin:

And.

. Marvin:

Around I think 2012, I already completely ditched Google services from my phone.

. Marvin:

, that was basically also the time where I started also developing what could

. Marvin:

be considered , the first precursors of MicroG which is an alternative to

. Marvin:

the network based location provider and an open source implementation

. Marvin:

of the Google lock in service.

. Marvin:

So, yeah, that's , how I started into this

Mishaal:

2011 was a wild time in that, era of Android.

Mishaal:

I think most of us in this, the tech industry who cover Android, , for a

Mishaal:

living nowadays, we all started out like, Shopping around on XTA because the,

Mishaal:

stock Android experience on phones back then was just generally not very great.

Mishaal:

So, custom ROMs and all sorts of wild modifications were, really hot back then.

Mishaal:

But, , nowadays it's not as popular.

Mishaal:

There are still a thriving community of users who want to DEO their

Mishaal:

devices and they want to, , own the, the software running on their phone.

Mishaal:

So MicroG is a crucial project in enabling users to DEO their devices.

Mishaal:

But before we dive into MicroG, I wanted to lay down some background information.

Mishaal:

So our listeners are all on the same page as.

Mishaal:

So Google play services, it's present on all GMs and Android

Mishaal:

devices without exception.

Mishaal:

It's part of GMs core services.

Mishaal:

And in fact, Google even calls it GMs core internally.

Mishaal:

So we've talked extensively about how GMs is licensed and why OEMs choose

Mishaal:

to license GMs in previous episodes.

Mishaal:

So I won't be retreading old ground here.

Mishaal:

All you need to know is that Google play services is basically ubiquitous.

Mishaal:

In fact, whenever Google provides an estimate of how many Android devices are

Mishaal:

in the wild back at IO, they said there was about 3 billion active devices in use.

Mishaal:

They're likely using Google play service to make that estimation

Mishaal:

because it's literally installed on nearly every consumer, Android

Mishaal:

device out there with the exception.

Mishaal:

Devices that are sold by Huawei for reasons.

Mishaal:

You can look up that are more political than anything else, as

Mishaal:

well as devices sold in China, which is a long standing, , Complication

Mishaal:

with Google services in China.

Mishaal:

, Google services it's present on every device and it powers so many features

Mishaal:

that user may not have been aware of.

Mishaal:

Like there are features that it's actually part of Google based services, but the

Mishaal:

user may think it's part of the native OS or it's just built into their phone.

Mishaal:

Can you list some of the features that users may not be aware are actually,

Mishaal:

Google place services powered.

, Marvin:

I guess for this, we want to just, split up those kind of services

, Marvin:

that Google play services provide and categorize them a little bit

, Marvin:

because there's four types of things that can be found in place services.

, Marvin:

So one is the APIs.

, Marvin:

it does provide two third party applications so that they can

, Marvin:

have the developers of third party applications can make use of some APIs.

, Marvin:

Then there's APIs that are specifically meant only for Google

, Marvin:

apps or good partners that are not publicly documented anywhere, but

, Marvin:

still exist inside play services.

, Marvin:

Then play services also extends the operating system directly by

, Marvin:

hooking into Some functions , that AOSP provides allowing to extend

, Marvin:

features of the operating system.

, Marvin:

And then play services also has features that I would say are more

, Marvin:

like standalone features, which any app could technically provide, but for some

, Marvin:

reason, integrated into play services.

, Marvin:

So for each of them, there's probably , a few things that

, Marvin:

people , are not that familiar with.

, Marvin:

, for , the public APIs that are often used by applications I think the one

, Marvin:

that people most often do not have insight that this actually is Google

, Marvin:

things happening on that device is when applications have the QA code

, Marvin:

reader like, any, I dunno, share.

, Marvin:

Bike app or whatever.

, Marvin:

Then you have to unlocked the bike with the app and you're scanning the QR code

, Marvin:

and that part already ISS play services.

, Marvin:

So there's , no obvious link to Google technology here or

, Marvin:

anything related to Google, but still it is running play services.

Mishaal:

Oh, sorry.

Mishaal:

I just wanted , to step in here just to list some user facing features,

Mishaal:

like I prepared a laundry list of features, cuz I kind of wanna give.

Mishaal:

A picture of just how massive this single app is and how, much it does.

Mishaal:

, if you're familiar with the fine, my device feature, which is a way for you

Mishaal:

to locate your lost or stolen device, there's an app for that on Google play.

Mishaal:

But all that app is just a front end, the actual service that does

Mishaal:

the location tracking and, syncs with the Google servers is built into

Mishaal:

play services, Google pay and wallet.

Mishaal:

Sure.

Mishaal:

There's an app for that, but the actual service that handles adding

Mishaal:

your card and holding your wallet and making contactless payments, that's

Mishaal:

all in place services, the auto fill service that's place services,

Mishaal:

parental controls, the family link app.

Mishaal:

You can download all that does is let you manage settings.

Mishaal:

You have the backup support.

Mishaal:

So whenever you're setting up a device or you're making a

Mishaal:

backup that's play services.

Mishaal:

QR code scanner and Android 13, or the one that apps can integrate.

Mishaal:

As Marvin mentioned, fast play services, fast pair nearby share

Mishaal:

Google cast, the new game dashboard, Android, 13 Chromebook syncing,

Mishaal:

Google security, checkups, smart lock.

Mishaal:

There's just so much that Google play services does.

Mishaal:

That usually may not even be aware are actually provided by the app.

Mishaal:

And of course these are user facing features, so that's not really an issue

Mishaal:

if they compete with functionality offered by other applications, but there are also

Mishaal:

a lot of APIs that it offers that I think will, you'll start to understand why

Mishaal:

it's beneficial and a downside to have Google play services centralize all this.

Mishaal:

, can you list some of these APIs that , you were about to get into that?

Mishaal:

Marvin, can you list some of the most commonly used APIs

Mishaal:

provided by play services?

Marvin:

So I think , the most popular API is probably the push notification

Marvin:

API and the Google maps API.

Marvin:

So whenever a map is displayed inside an application then that's

Marvin:

a Google map's API typically.

Marvin:

And whenever you yeah, somehow receive push notifications and

Marvin:

that's the Google cloud messaging API for push notifications.

Marvin:

So nowadays called fire based cloud messaging.

Marvin:

Those are really, really popular APIs then also the fire base API set of

Marvin:

fire base functionality set is handed.

Marvin:

Through place services as well.

Marvin:

So, that's applications making use of of Firebase authentication, Firebase database

Marvin:

, and a lot of these functionality that's provided by Google, which is for the

Marvin:

Firebase SDK, which is meant to allow easy cross-platform application development.

Marvin:

All of these functionalities rely on on play services as.

Mishaal:

So you mentioned earlier about you originally started out

Mishaal:

MicroG as providing an implementation of the location provider.

Mishaal:

Can you explain what exactly , Google based services deals

Mishaal:

with in terms of location?

Mishaal:

Like what does it offer to apps?

Marvin:

Okay.

Marvin:

So, basically there's two parts to the location story and play service.

Marvin:

First the operating system has some extension point where technically

Marvin:

the operating system provider, which on a normal end device

Marvin:

actually is the device manufacturer.

Marvin:

Can inject some network location provider, which then when applications would like to

Marvin:

request the operating systems or ask the operating system for, for what the current

Marvin:

location of the devices they can either use the GPS or they can use , the result

Marvin:

from that network location provider.

Marvin:

And then play services obviously provides one network location provider.

Marvin:

But often enough the network location provider is actually

Marvin:

overwritten or a different one is used by the operating system.

Marvin:

Interestingly Qualcomm as one of the major manufacturers provides an

Marvin:

alternative and many devices, actually, Yemen manufacturers decide to ship that

Marvin:

and on their device instead of having Google play services enabled by default.

Marvin:

That's why at some point Google made a new API called ause location provider

Marvin:

API, which is basically an API that has the same feature set as a system location

Marvin:

API, but would never use the system provider network location provider, but

Marvin:

always use the Google location provider.

Marvin:

So Google will learn about all network location requests and all of them goes

Marvin:

through the Google API and never through any manufacturer decided network location.

Mishaal:

So I can understand why developers would jump on using the

Mishaal:

maps API provided by place services.

Mishaal:

I mean, I think we can all agree that the quality of Google maps

Mishaal:

is just significantly better than other mapping services.

Mishaal:

But when it comes to push notifications through fireplace cloud messaging

Mishaal:

and, location, access through views, location provider, like I don't think

Mishaal:

it's leaps and bounds better than.

Mishaal:

services.

Mishaal:

So why do so many applications?

Mishaal:

Use these APIs instead of, alternatives, what is the benefit for app

Mishaal:

developers and why do they use them?

Marvin:

So, for app developers say app, the benefit that if they use the

Marvin:

play services API , or , the Google provided APIs here, then , they

Marvin:

basically have some good documented , and already provided code for that.

Marvin:

So that's Google really has the advantage of.

Marvin:

By providing the official Android documentation, they can easily

Marvin:

get developers into using also their not open parts , of Android.

Marvin:

, for example, look into the location provider API, the an a S P and the

Marvin:

documentation for that you would actually then just directly in the head, I

Marvin:

get an like the upper part, get some information that says basically,

Marvin:

yeah, that C and not that good API, please use location provider API

Marvin:

from Google play services instead.

Marvin:

So, Google is really making obviously use here of being the , first party for

Marvin:

any information about the platform.

Marvin:

And then the other part for push notifications.

Marvin:

It's also the part that the play services provider for push notifications

Marvin:

is already installed on every device.

Marvin:

So, you already have that installed and you cannot easily Have set up an

Marvin:

alternative push notification provider because those need to run always in the

Marvin:

background and the aggressive battery safety measures of Android will make

Marvin:

it impossible for certain parties to provide a push notification provider.

Marvin:

So the only option that you actually have as a developer or the only really good

Marvin:

option is to use the one from Google.

Marvin:

, it's also to some degree, just not having , any options or any choice here.

Marvin:

There's even libraries for developers that allow you to use the push notifications

Marvin:

of Google or any other provider that is installed so that if you are on one

Marvin:

of the few devices that have something else, you could actually use something

Marvin:

else, but in practice, it will always be the Google push notifications.

Marvin:

Anyway.

Mishaal:

Right.

Mishaal:

I kind of wanted to, follow up on the point about push notifications because

Mishaal:

it's a really complicated subject.

Mishaal:

, on a desktop PC, you can assume basically you have unlimited power, so you could

Mishaal:

have any number of push notification frameworks running, and it wouldn't

Mishaal:

really impact the overall system health all that much, but on an Android device,

Mishaal:

which you assume to be battery powered.

Mishaal:

If you have 10 different push notification services, all running, foreground

Mishaal:

services , and, having these alerts come in, you want them to be real time alerts.

Mishaal:

If you have so many different things running at the same time, you will.

Mishaal:

Less of a chance for the device to enter its device idle state,

Mishaal:

or do mode as Google calls it.

Mishaal:

And so with Google play services, which is, allow listed from do

Mishaal:

mode and, any kind of network battery saver mode, it's able to.

Mishaal:

Actually react to push notification events in real time without having

Mishaal:

to be restricted by Androids, do mode and battery saving features, which

Mishaal:

are intended to save battery life.

Mishaal:

It's both.

Mishaal:

Reducing power usage, consolidating push notification services.

Mishaal:

But at the same time, it forces everyone to use fire based cloud messaging,

Mishaal:

which also means that push notifications become entirely dependent on Google.

Mishaal:

And there's one market where this is completely not true.

Mishaal:

And that's the Chinese market.

Mishaal:

And I wanted to ask you, Marvin, do you have any insights about the

Mishaal:

situation in the Chinese market?

Mishaal:

, can you talk about.

Mishaal:

The decentralized push notification the other APIs there, because

Mishaal:

, Chinese and your devices don't have Google play services.

Mishaal:

So can you talk a bit about that?

, Marvin:

I'm also definitely not an expert on that, but I know , there's

, Marvin:

several basically push providers in the Chinese market , and often

, Marvin:

enough apps just provide their own version of a push provider.

, Marvin:

Or the, also the operating system comes even with multiple push

, Marvin:

providers installed already.

, Marvin:

Then the application can connect to those and have an option which

, Marvin:

push provider they want to use.

, Marvin:

But on the other hand that makes all the.

, Marvin:

Other Chinese custom versions of Android often having very weird behavior when

, Marvin:

it comes , to battery optimization.

, Marvin:

So it can easily be that an application that works great on our GMs Android

, Marvin:

device will just not work properly , on this Chinese branded ROMs because.

, Marvin:

, the battery saving measures just, work completely different.

, Marvin:

That then basically causes maybe even more issues than just having

, Marvin:

, the OID way, how Google does it.

, Marvin:

But I wanted all to chip in on the issue of push notification on the battery.

, Marvin:

I think there's generally a little bit.

, Marvin:

Misconception that if you have multiple push notification providers that would

, Marvin:

not significantly actually increase the battery usage because each of

, Marvin:

them, as long as it's only a push notification provider could be , a good,

, Marvin:

well done efficient push notification provider, similar to how a DMS.

, Marvin:

Actually is in the, at least for the push notification part , is

, Marvin:

very good in, in battery efficiency.

, Marvin:

But doing that three times or running that three times will not

, Marvin:

have any significant impact on the battery because basically that.

, Marvin:

A push notification provider that runs always in the background would just

, Marvin:

rarely actually cause any network or CPU activity because you just have to

, Marvin:

keep a persistent connection , to the push notification server side and for

, Marvin:

a connection to be kept persistent.

, Marvin:

You just have to send some ping packet around two times an hour.

, Marvin:

, waking up the device two times an hour to send just a single packet as obviously

, Marvin:

not a lot of resources, but doing that 10 times and sending , 10 packets would

, Marvin:

also not be an issue if at least those 10 packets are sent at roughly the same

, Marvin:

time, because then you still have half of the hour that you can be in those

, Marvin:

mode , and just wake up, send 10 pickets and then sleep another half an hour.

, Marvin:

And then basically you still have the same battery consumption or

, Marvin:

similar battery consumption than if you have just one push provider.

, Marvin:

So the issue is less that multiple push providers would need needing more energy.

, Marvin:

The issue is more that most alternative push providers

, Marvin:

that exist are just far less.

, Marvin:

Well done than the Google one.

, Marvin:

And that then obviously has other issues because the operating

, Marvin:

system would already take care.

, Marvin:

So AOS P already takes care of synchronizing those network

, Marvin:

requests so that they are at the same time those ping requests.

, Marvin:

So that would already be possible.

Mishaal:

Okay.

Mishaal:

Yeah.

Mishaal:

Thanks for the insight.

Mishaal:

I wasn't really sure of how quantifiable , the power use actually is from having

Mishaal:

multiple push notification providers.

Mishaal:

But I guess , the user experience might be impacted because to have each of those.

Mishaal:

Per running persistently, even if the battery drain is negligible, they'd

Mishaal:

still require foreground services.

Mishaal:

Right.

Mishaal:

And that would thus require them to have, persistent notifications.

Mishaal:

And then you have all these different, notifications running for each app that

Mishaal:

needs to have notifications being sent.

Mishaal:

And then, , notifications panel becomes kind of a mess.

Mishaal:

And yeah, I can see why, like a lot of OEMs, Chinese OEMs, reacted so

Mishaal:

aggressively with their battery saving measures because , they can't really

Mishaal:

guarantee that a user is only using maybe one or two highly efficient

Mishaal:

push notification services or their apps are using are using those

Mishaal:

efficient push notification services.

Mishaal:

So they kind of respond with these highly aggressive background management features

Mishaal:

that are often enabled by default and.

Mishaal:

Those features are often enabled even on the international

Mishaal:

versions of their devices.

Mishaal:

So you have Western reviewers complaining about their apps, not working

Mishaal:

because app developers are expecting a S P like behavior, but then they're

Mishaal:

encountering these Battery saving measures that aren't really comporting.

Mishaal:

They aren't really , following CTS and what you would expect on an AOSP device.

Mishaal:

So if you're wondering, the root cause of these aggressive battery

Mishaal:

saving measures on mostly Chinese branded OEM devices, this whole.

Mishaal:

Decentralized nature of the Chinese market without access to Google play services is

Mishaal:

, the root cause it's to blame, but that's not being said, that is one benefit.

Mishaal:

One like tangible benefit to having a centralized, Google

Mishaal:

play services provider, providing all these APIs and services.

Mishaal:

But of course the downside is that.

Mishaal:

In the west, at least kind of most app developers.

Mishaal:

You kind of assume that if you're dealing with an enter device, it has

Mishaal:

Google play services installed, and that's not going to be true on every

Mishaal:

device, especially if you are a power user and you opt to install, an a O S P.

Mishaal:

Custom RO or you DEO your device or, you'd like to customize an off the shelf

Mishaal:

device for, enterprise use, then you're not going to have Google play services

Mishaal:

installed, but because most app developers assume it's there, they don't use the,

Mishaal:

libraries that Marvin mentioned that allow the app to actually change providers

Mishaal:

based on what's available on the device.

Mishaal:

So I wanted to ask you Marvin, can you talk.

Mishaal:

The experience of actually using an app that depends on play services

Mishaal:

on an AOSP device that doesn't have something like MicroG installed.

Mishaal:

What can users expect from their experience of using these apps?

Marvin:

Well, if the app really completely relies on play services, then often

Marvin:

enough just start trying to solve.

Marvin:

It will basically , the app will just show in dialogue saying you need to

Marvin:

update or install, play services.

Marvin:

And if.

Marvin:

Say yes or, okay.

Marvin:

It will , try to open the play store, which then doesn't happen because

Marvin:

the play store is not installed and then will just not work at all.

Marvin:

Some applications are a bit let's say more, resilient to that situation.

Marvin:

But the behavior often is not, much better so often.

Marvin:

For example, if if you have an application that shows Google map, API embedded

Marvin:

normally, and then if play service is not installed and you are trying to open

Marvin:

the part of the app where the map is shown, it would just crash instantly.

Marvin:

So that's one thing that you can.

Marvin:

Then obviously you have to issue that if the application silently

Marvin:

ignores the fact that it does not receive push notifications, then

Marvin:

the behavior of the application might make it completely unusable.

Marvin:

Think of maybe WhatsApp, just without getting a notification

Marvin:

for incoming messages.

Marvin:

I mean, that would be completely useless as an application.

Marvin:

If you always would have to open WhatsApp just to check if there's a new

Marvin:

message or some applications even worse.

Marvin:

Rely on the push notification system to actually show the

Marvin:

notification to the user.

Marvin:

So even if you would be opening the app manually, you would still not

Marvin:

see the information that would be coming through the push notification.

Marvin:

So some apps , are really bad in supporting non GMs devices

Marvin:

and . behavior can vary lot.

Marvin:

What you see a lot is really applications showing , some popup saying you need to

Marvin:

update, play services that are common.

Marvin:

And then if you ignore that popup then , what happens afterwards

Marvin:

, can be basically anything.

Marvin:

, and you're on your own if you try , to use the app in

Mishaal:

that situ.

Mishaal:

Yeah.

Mishaal:

And just to reiterate play services, the APIs it provide, it's not

Mishaal:

just push notifications and a location provider and the maps API.

Mishaal:

There's a laundry list of APIs that it provides also including Fido.

Mishaal:

So for authentication purposes, the new ultra wide band API ML kit , you

Mishaal:

can provide in like a barcode scanner, as Marvin mentioned, play games.

Mishaal:

So if you're, wanna synchronize or store games, data, Google servers, safety net

Mishaal:

at a station the wearable API, if you want to transfer data to a wears device,

Mishaal:

Google fit, and any apps that use, fire base for analytics data, although, play

Mishaal:

services, doesn't directly provide it.

Mishaal:

Those SDKs do depend on play services being installed.

Mishaal:

So you might have an app that's completely nonfunctional or just crash on launch

Mishaal:

because they don't have an exception.

Mishaal:

For in the case of play services, not being installed, you might have an app

Mishaal:

that's just missing some functionality.

Mishaal:

Like, as Marvin mentioned, you not getting notifications, or you might

Mishaal:

just have some, one or two obscure bugs that you don't even realize until you

Mishaal:

actually try to, enable the feature.

Mishaal:

Your mileage is going to greatly vary because they.

Mishaal:

Don't really account for the situation where play services is not present.

Mishaal:

They kind of assume it's there.

Mishaal:

The vast majority of, apps distributed on Google play assume

Mishaal:

you have play services installed.

Mishaal:

And when you don't, you're on your own, you gotta figure things out.

Mishaal:

And there are websites and tools you can use to figure out,

Mishaal:

Will this app actually work?

Mishaal:

Will it work well on my, a SB device?

Mishaal:

You could install an AO S P build on in theor or a GSI on a real device and then

Mishaal:

run it and then just see what happens.

Mishaal:

See what's working and what doesn't work.

Mishaal:

You could also, inspect the APK to see if there's any, included

Mishaal:

permissions or libraries that, relate to GMs functionality.

Mishaal:

There are third party sites like plexus that, are user contributed and

Mishaal:

Exodus, which, analyzes, trackers.

Mishaal:

, you could see if there's any fire base or any GMs or Google ad services.

Mishaal:

Like.

Mishaal:

Libraries integrated, but overall really you're on your own.

Mishaal:

You gotta test the app.

Mishaal:

You just gotta, if you know the app, and if , you develop the app, then you

Mishaal:

probably know what you're using, but if you're a user of an app, then it's tough

Mishaal:

to actually work around and getting a lot of your favorite apps up and running.

Mishaal:

One thing you can do is install MicroG and while it doesn't

Mishaal:

provide every feature and API that Google play services provides.

Mishaal:

It does provide some of the core functionality or reimplement,

Mishaal:

some of the core functionality.

Mishaal:

So I wanted to ask you, Marvin, can you tell our listeners exactly what is MicroG

Mishaal:

and how does it, solve the issue of a lot of apps being completely broken or having

Mishaal:

key functionality missing on AOSP devices?

Marvin:

Sure.

Marvin:

So, Myrie is basically just to complete reimplementation of the play services.

Marvin:

But obviously it's not complete.

Marvin:

So, it's currently only implementing as upset and it's very likely that it will

Marvin:

never provides the full functionality just because Google is also constantly

Marvin:

adding new functionality to play services.

Marvin:

So, will be impossible , to keep catch at any point.

Marvin:

But at, at least for , the APIs provided to a third party it's basically

Marvin:

already good enough to have many apps working far from supporting every app.

Marvin:

But yeah.

Marvin:

also heavily depends on the functionality needed by the application.

Marvin:

So just to , give an idea which APIs have provided obviously push notification

Marvin:

is provided so that applications using Google cloud messaging or fire based cloud

Marvin:

messaging can receive push notification a location providers available Google

Marvin:

maps, implementation based on actually open street map data design, and.

Marvin:

original Google web data because that's not available to set parties

Marvin:

functionality for safety net, which is used by a lot of banking implications.

Marvin:

, the QR code scanner that I mentioned is also available and then a few smaller

Marvin:

parts where we try to at least have some.

Marvin:

Stop implementation, implementation that is incomplete, or doesn't actually do

Marvin:

something useful, but we'll make sure that the application trying , to use that

Marvin:

API will at least behave , more useful than than if it wasn't present at all.

Marvin:

So for example, if an application wants to use, Google drive API to

Marvin:

access your Google drive contents.

Marvin:

Then we would just return that your Google drive is always

Marvin:

empty, which is still better than having the application crashing.

Marvin:

Of course.

Marvin:

So, yeah, , that's , something that, is in, in MicroG for APIs that are

Marvin:

not actually properly supported.

Marvin:

And yes, that's all the features, , basically the idea

Marvin:

of what MicroG can provide.

Marvin:

So that third party applications get, , the functionality back that

Marvin:

they originally were meant to have.

Marvin:

We are really focusing , on the third party APIs and not the

Marvin:

other parts of play services.

Marvin:

Although it's always also interesting to look into those and.

Marvin:

It's always motivation to also look into maybe implementing some of

Marvin:

them but supporting applications or , that wanna use the third party.

Marvin:

APIs is , much more important right now.

Mishaal:

Yeah.

Mishaal:

So, first of all, I wanna really applaud you guys, you and whoever else contributes

Mishaal:

to MicroG because play services, as I mentioned is a complete black box.

Mishaal:

It is proprietary and closed source and there is no public documentation

Mishaal:

for all the features that it offers.

Mishaal:

So like being able to actually.

Mishaal:

Peel back the layers of play services and provide some of the same

Mishaal:

functionality in a way that's transparent apps is a really impressive feat.

Mishaal:

And , it's a constant challenge to actually keep up with play

Mishaal:

services because through play services, Google is able to just

Mishaal:

roll out new features like that.

Mishaal:

The earthquake alerts, the air raid alerts, , the COVID 19 exposure

Mishaal:

notifications is a big one where they, within a matter of months, we're

Mishaal:

able to roll out this feature to.

Mishaal:

Billions of devices around the world nearby sheriff is another one.

Mishaal:

And like all these features it's like being able to keep up with Google

Mishaal:

is not an easy feat, especially because , none of these are open source.

Mishaal:

So, yeah.

Mishaal:

Great job on MicroG.

Mishaal:

I did wanted to ask you though, , you implied this basically that apps don't

Mishaal:

really have to actually support MicroG.

Mishaal:

They don't really know that it's MicroG installed.

Mishaal:

They're using the same Google drive API call, but instead MicroG will

Mishaal:

feed them that the drive is empty.

Mishaal:

So instead of crashing, they'll just return empty, receive empty data.

Mishaal:

So this kind of implies that you're kind.

Mishaal:

Replacing Google play services transparently, but I wanted to

Mishaal:

ask you about this actual process.

Mishaal:

Like how do you actually install MicroG in a way that makes apps think

Mishaal:

they're talking to play services, but they're actually talking to MicroG.

Marvin:

Yeah, sure.

Marvin:

So, , maybe some history here.

Marvin:

I mentioned I was doing the network location and Google look in manager.

Marvin:

And also back then, what was called the Google services framework.

Marvin:

And for all of those services, they work, they, came pre-installed

Marvin:

on the device, of course.

Marvin:

And they basically had.

Marvin:

API, which on Android is basically specified using a service name

Marvin:

and appropriate Android interface, definition, language file, which is.

Marvin:

Then used to specify how to connect to that service.

Marvin:

All of these services that Google provided previously had those

Marvin:

available, and that was how applications were meant to access it.

Marvin:

So basically replacing those.

Marvin:

Was super easy because I would just have to provide the server side of those and

Marvin:

install my application to, or my very end of that Google service to the system

Marvin:

petition just like, the original one was.

Marvin:

And then the application would just pick up that one.

Marvin:

And because I provided a service which runs on the same intense filter.

Marvin:

, that's absolutely no issue.

Marvin:

And when they introduced play services, they had the issue, they

Marvin:

were doing something that was new.

Marvin:

So, back then play services was not shipped on the device , nowadays it's

Marvin:

part of the system as well as any other Google system part, but when

Marvin:

they originally introduced it, , in the times of, I don't know, Android

Marvin:

four got something, I don't know.

Marvin:

Then They had to install it as a new application.

Marvin:

Basically it was automatically installed through the play store, but still it

Marvin:

was a new application that was not shipped with the operating system.

Marvin:

And for that reason, they had to do something new to protect applications

Marvin:

from using , some malicious version of play services that could exist that

Marvin:

Would then be installed the same way that play services installed, which is

Marvin:

just a normal application at that time.

Marvin:

So anyone could actually install, play, or in any play services thing could be

Marvin:

installed because you could also just like a normal application, uninstall play

Marvin:

services and then install another one.

Marvin:

For that, they introduced some signature checks.

Marvin:

So.

Marvin:

Application that the third party application that tries to use play

Marvin:

services will first before accessing as our APIs, which also are not

Marvin:

that easily documented anymore, but that's another a story I would say.

Marvin:

Before they did allow doing that they actually, connect to the service provided

Marvin:

as a normal Android service they would check the signature of the APK that claims

Marvin:

the package name , of play services.

Marvin:

And . That became a major issue , for developing something like MicroG

Marvin:

because if MicroG would just take place there, the signature would not match.

Marvin:

So the third party application would say, okay, the signature does not

Marvin:

match and behaves basically as if.

Marvin:

MicroG was not installed.

Marvin:

So we had that issue.

Marvin:

And the solution that I came up with is basically a small patch to the

Marvin:

operating system that when the specific call that the applications or the place

Marvin:

services, SDK, that applications use.

Marvin:

To find figures out just the, the signature basically replacing that

Marvin:

call or changing that call such that it returns the, the Googled signature,

Marvin:

even . When the MICG version of the, of play services is installed.

Marvin:

So that is very good way , to work around that issue, but unfortunately

Marvin:

requires modifying the operating system.

Marvin:

So installing becames much harder because it's not just, pushing some APK on your

Marvin:

system petition thing, but it became.

Marvin:

Modifying a S P itself.

Marvin:

So yeah, but that's how we can basically transparently act

Marvin:

as if we will play services.

Marvin:

We're providing just the very same API and through that modification

Marvin:

that is called signatures proofing.

Marvin:

the application that normally would use play services , the operating

Marvin:

service system will just tell.

Marvin:

That the MicroG version is the same as if it was the original play services version.

Marvin:

So that's how we can do it completely trans.

Mishaal:

Awesome.

Mishaal:

Thanks for that explanation.

Mishaal:

We've actually talked about this briefly in our previous episode where we invited

Mishaal:

a developer from graph OS to talk about their sandbox or , they mentioned their

Mishaal:

sandbox play services implementation.

Mishaal:

So I recommend going back and listening to that.

Mishaal:

It's a alternative.

Mishaal:

To the MicroG approach, but both are completely valid.

Mishaal:

And so I don't really wanna, compare them here.

Mishaal:

I did wanna ask , , if you can share some additional insights into the play

Mishaal:

services app itself, because from all we've talked about, this laundry list

Mishaal:

of features and APIs and services that it offers yet on my pixel six

Mishaal:

pro the app itself only takes up.

Mishaal:

550 megabytes of storage.

Mishaal:

And, I'm kind of surprised by how much it's able to offer without being way

Mishaal:

bigger than I thought it would be.

Mishaal:

So can you talk a bit about the actual structure or place services, how is

Mishaal:

it able to offer so much and yet, not take up multiple gigabytes of space.

Marvin:

Okay.

Marvin:

So I, guess if you're talking about 500 megabytes of space, then that's

Marvin:

probably already including the data part of the app, because I think , the

Marvin:

APK download itself is probably going to be, 100 or 200 megabytes only right.

Marvin:

I'm following that.

Marvin:

I'm not following that the amount, but should be around that.

Marvin:

And that's because.

Marvin:

other parts of play services can also be fetched later.

Marvin:

So, Google invented some system here that allows to basically load modules of.

Marvin:

From the Google server with status that do not come with the APK itself.

Marvin:

And those modules can also be removed if they are not used anymore.

Marvin:

Although that typically does not happen a lot.

Marvin:

So once you have an application that uses an API that is only provided

Marvin:

through module, that is an external module, then obviously , you typically

Marvin:

continue to use that application and then there's no way to uninstall.

Marvin:

Module again.

Marvin:

But yeah, basically they have a package manager inside place services

Marvin:

to make sure that the needed features are there when needed.

Marvin:

But that you do not need the full space for all the features all the time.

Marvin:

But I also think that another trick that they do is , what you already mentioned

Marvin:

that , for many of the features, like find my device, things like that., they

Marvin:

have an extra app for actually using it.

Marvin:

So while the core technology itself, the logic , of the service is inside

Marvin:

play services . Also big parts of applications, which is, assets like

Marvin:

images, user interfaces, and so on.

Marvin:

That's not part of play services or often only parts of it part of play services.

Marvin:

So that makes it easier for Google to.

Marvin:

Ship all of these basically have find my device installed on your device

Marvin:

already inside the play services.

Marvin:

But if you want to use it and you need the user interface, then

Marvin:

you'll download another package.

Marvin:

And that can give you another few megabytes , storage just for

Marvin:

the launcher application as to say because that has the assets

Marvin:

that are needed to, define my device and the same applies to

Marvin:

other functionalities as well.

Marvin:

Like, the Google pay, for example, it's a similar situation there.

Mishaal:

Yeah.

Mishaal:

And often from what I see, Google tries to.

Mishaal:

Make these features appear as if they're, natively integrated into the Android OS

Mishaal:

by, some mechanism in the settings app itself that allows other system apps

Mishaal:

to inject their preferences by having like a special intent filter defined.

Mishaal:

And then, Google goes the extra mile in theming, a lot of these activities.

Mishaal:

So they feel like they're built into settings.

Mishaal:

, a lot of these features, even though.

Mishaal:

Part of it is provided by play services.

Mishaal:

Part of it's provided by another app.

Mishaal:

You download, it all feels cohesive and part of Android itself, even though if you

Mishaal:

download a OSP, all of these are missing.

Mishaal:

, there's just so much provided by this gargantuan mega app that you

Mishaal:

just probably will never be aware is actually provided by play services.

Mishaal:

Although it is quite easy to tell, is something play services

Mishaal:

or is it this actual app?

Mishaal:

Like if you open a settings page and then you just swipe up to the recents app,

Mishaal:

And then you long press on the app icon.

Mishaal:

If it says play services, that means it's part of play services.

Mishaal:

So it's actually pretty easy to find out what apps actually

Mishaal:

providing the functionality.

Mishaal:

Although it, it gets a little Meier.

Mishaal:

Once you start digging into the details of some of , the backend APIs and services.

Mishaal:

I wanted to ask you, Marvin do you know of any APIs or features that were first

Mishaal:

baked into play services, but eventually were open sourced and added to AOS P

Mishaal:

like, do you know of anything like that?

Marvin:

we've seen quite a bunch of the other way around, like I mentioned

Marvin:

location is basically just the situation.

Marvin:

There's also GA fencing which basically allows you listen for

Marvin:

the event of, being at home or at some certain spot in the world.

Marvin:

That also was originally provided as a, a S P API.

Marvin:

And I think technically it still is, but it just doesn't work on the as P API.

Marvin:

So you have to use the Fu location provider for that as well.

Marvin:

So when location we see is pretty much the opposite side but I, I'm not sure

Marvin:

if there's really anything , where they did it the other way around.

Marvin:

They promised it to do, for example, for the exposure

Marvin:

notifications, , the COVID 19 API.

Marvin:

Which when originally they said, yeah, we do it in play services because

Marvin:

because you wanna ship it as fast as possible, but we will make it open to

Marvin:

and put it in ASP in the next release.

Marvin:

And then that never happened because nobody really was asking for that.

Marvin:

And obviously they were not really interested , in doing.

Marvin:

Because they were already happy with the situation inside place services.

Marvin:

So there was no need.

Marvin:

So, I'm not really aware of Google opening things up that,

Marvin:

they previously made close.

Marvin:

So that's, that's something I, don't think would be

Marvin:

really much in their interest.

Marvin:

Although there could be something which I don't have in mind, right.

Mishaal:

Now that you mention it, you do remind me of announcement.

Mishaal:

They made at Google IO about the cross device SDK, which was just

Mishaal:

released for developers as a beta.

Mishaal:

That's provided through place services right now, but at IO, they

Mishaal:

did mention that that was going to be added to a O S P with Android 14.

Mishaal:

So we'll see if that ends up happening year from now , before we.

Mishaal:

Move on, to the closing things that I wanted to ask you, we've kind of made

Mishaal:

an assumption that if in SDK is offered through Google place services and an

Mishaal:

app tries to use it, and Google play service is not installed on the device.

Mishaal:

That, that functionality won't be possible.

Mishaal:

It won't be usable.

Mishaal:

Are there any SDKs that, an app can actually integrate, they can have

Mishaal:

a thin client for, and that even if play services is not installed, that

Mishaal:

functionality will still work regardless.

Mishaal:

Can you name any examples?

Marvin:

Yes, there's actually a few of those where if the app developer knows

Marvin:

how to do that, then they can have it.

Marvin:

, and for some of them it's also the default or Google really

Marvin:

pushes developers to do that.

Marvin:

And I think the one where they really do that is , the mobile ads.

Marvin:

So that the advertisements are also shown on , non GMs devices because that's also

Marvin:

good for Google if those ads are shown.

Marvin:

So they are interested in having that SDK shipped on as many devices as possible.

Marvin:

And third party providers doing that for them's also good for them.

Marvin:

So, that's why they do it at, for the mobile that, but there's also

Marvin:

few, I think the the ML kit can do that, which is used for the uh,.

Marvin:

RI for example also Google analytics can do that.

Marvin:

, if the app is using Google analytics or Firebase analytics for many

Marvin:

of the Firebase services, that's actually technically possible, but

Marvin:

many application developers do not.

Marvin:

Make use of that or . Maybe it's just not possible because they

Marvin:

are not releasing the packages.

Marvin:

So, at least from, what I can see , on the MicroG side, how

Marvin:

the requests are done I know that technically it could also be bonded for

Marvin:

basically all of the fire base APIs.

Marvin:

So, yeah, generally bundling some of the SDKs directly with the application is

Marvin:

something that's possible for, some of the APIs, not all of them, of course.

Marvin:

But yeah beside, for the mobile that I don't think it would really

Marvin:

push us or lets developers know that this , maybe a good idea.

Marvin:

They would just not tell the user or make it a smaller site.

Marvin:

And then they just have that feature because it might be just, it's a

Marvin:

requirement for more providing that API for, I don't know, maybe some government

Marvin:

or things like that, so they have it.

Marvin:

But they don't really push developers to use it.

Mishaal:

Right.

Mishaal:

And this is the part where I'm going to be plugging Esper, because if you've

Mishaal:

been listening through this entire episode, then I'm sure you'll agree.

Mishaal:

That play services is really, really complicated and it's not easy figuring

Mishaal:

out whether or not you actually.

Mishaal:

Need to have it installed on your device.

Mishaal:

And if you're an enterprise that asks questions about whether or not your

Mishaal:

fleet of dedicated devices needs play services and thus Google mobile services,

Mishaal:

come talk to us at Esther deploying GMs.

Mishaal:

Android may help you avoid app compatibility issues, but it's

Mishaal:

not always a fast, straightforward or cost effective solution.

Mishaal:

And it's certainly not one we recommend navigating yourself.

Mishaal:

If you have a kiosk point of sale terminal or exercise machine, it

Mishaal:

doesn't need full Google play access.

Mishaal:

But an app you want to deploy to those machines may need some APIs that are

Mishaal:

provided by play services, or it may not.

Mishaal:

We at Esper have extensive experience with building and deploying

Mishaal:

AOSP onto dedicated devices.

Mishaal:

So we can help you deal with any app compatibility issues or questions

Mishaal:

you might have on this front.

Mishaal:

Visit our website@esper.io to learn how to transform your device fleet.

Mishaal:

So, Marvin, before we calls off this episode, I wanted to

Mishaal:

ask where people can find you.

Mishaal:

Do you have any social media handles messaging at profiles or any chat

Mishaal:

rooms where people can find you in.

Marvin:

I am on, MasterONE.

Marvin:

So, if you are happen to be a MasterONE user, which is an open

Marvin:

federated alternative to Twitter then you can follow me there my

Marvin:

nickname Lama, which is L a RMA.

Marvin:

If you uh, want to do something else.

Marvin:

Technically, I'm also available for chat , on the X and P, which is also

Marvin:

federated tech network for, for chat systems or instant messaging systems.

Marvin:

So I'm available there as well.

Marvin:

And , you can probably figure out under which name and yeah, but , you won't

Marvin:

find me on any of the big social media platforms, because I just don't use them.

Mishaal:

Yeah, you really adhere to the, Dego life I had to install Dino.

Mishaal:

I am on WSL on my windows PC, just, to chat with you for this call.

Mishaal:

And I'm glad you responded though.

Mishaal:

I was kind of worried.

Mishaal:

I wouldn't be able to reach you., but thank you for taking the

Mishaal:

time to join us on Android bys.

Mishaal:

And one last thing, if people wanna learn more about MicroG, where can people go to,

Mishaal:

maybe download it or just read up on it?

Marvin:

Yeah, we have a very small, probably not so good website.

Marvin:

It's microg.org.

Marvin:

But you can also from there, go to our, and there, they it's.

Marvin:

Implementation of GMs core.

Marvin:

That's a nice, nice Wiki where you can get some information you can also find a

Marvin:

lot of information on third party sites.

Marvin:

So that's we, we are kind of a bit weak , on good documentation, to be honest.

Marvin:

Also, especially for developers that wanna join If you happen to be a person

Marvin:

that is interested in contributing to, to MicroG, then that's also very good reason

Marvin:

to just get in touch with me directly.

Marvin:

, on X and PPP or using Masteron or if you're not on that, , you

Marvin:

can probably also find my email address on the internet.

Mishaal:

Yeah.

Mishaal:

And if you are looking to DEO your device MicroG is definitely one of the top.

Mishaal:

Solutions you'll be looking at, along with, maybe a few custom ROMs, like

Mishaal:

graph OS that we've talked about before or lineage OS which is another popular

Mishaal:

option, but there are many different ways you can, take control of your device.

Mishaal:

It's whether or not it, you gotta evaluate your own threat model, your

Mishaal:

own privacy needs and, consider , is this a route you want to take?

Mishaal:

And , there are some challenges involved.

Mishaal:

But there's a vibrant community of people who have gone through

Mishaal:

this already who have, documented some of the worst offenders when

Mishaal:

it comes to AOSP compatibility.

Mishaal:

But I say this is someone who has used a Huawei device, which completely lacks

Mishaal:

any GMs, compatibility that it is usable.

Mishaal:

, it's not something I'd recommend to my parents, but it's something I could

Mishaal:

definitely use on a day to day basis.

Mishaal:

So give it a shot.

Mishaal:

If you are interested in, removing access to Google play services or

Mishaal:

GMs, or just de Googling your life.

Mishaal:

And thank you again, Marvin for joining us and thank you to everyone for listening

Next Episode All Episodes Previous Episode
Show artwork for Android Bytes (powered by Esper)

About the Podcast

Android Bytes (powered by Esper)
A weekly show that dives deep into the Android OS
Android Bytes (powered by Esper) is the podcast that dives deep into the engineering and business decisions behind the world’s most popular OS. https://www.esper.io

Android powers over 3 billion devices worldwide and is the platform of choice for over a thousand companies. You’ll find Android on smartphones, tablets, watches, TV, cars, kiosks, and so much more. How does Google architect Android to run on so many form factors, and how do companies fork AOSP to make it run on even more devices? These are the kinds of questions the Android Bytes podcast considers each week.

Join cohosts Mishaal Rahman and David Ruddock, two journalists with extensive knowledge covering the Android OS platform and ecosystem, as they speak to system architects, kernel engineers, app developers, and other distinguished experts in the Android space.

Get in touch with us at Esper.io if you’re looking to use Android for your product — we have the experience you need.

About your hosts

David Ruddock

Profile picture for David Ruddock
David is the Editor in Chief of Esper, and cohosts Android Bytes. David spent over 10 years as the Editor in Chief of Android Police, where he reviewed more phones than he'd care to admit, broke dozens of exclusive mobile industry stories (and also, phones), and ran one of the web's most vibrant Android communities.

Mishaal Rahman

Profile picture for Mishaal Rahman
Mishaal is the Senior Technical Editor at Esper.io and a cohost of the Android Bytes podcast. At his previous role as Editor-in-Chief at XDA-Developers, Mishaal was at the forefront of Android tech journalism, breaking story after story on new OS features and platform changes.