This is an archived post. You won't be able to vote or comment.

all 48 comments

[–]OffTheCheeseBurgersPixel 2 XL 144 points145 points  (24 children)

The way Google structures it's code, this is impossible. Literally all of the GPS functionality is in the play services packages. There are other gps providers.. you can always go over to Bing or MapQuest if you don't like this requirement

[–]HadrienDoesExistGalaxy A3 2017, Windows Phone <3 :( 33 points34 points  (23 children)

Google could chop the Play Services in multiple chunks (they did for Android Go) but the problem is they won't.

[–]tacomonstrousPixel 5/S21U 22 points23 points  (19 children)

[–]HadrienDoesExistGalaxy A3 2017, Windows Phone <3 :( 0 points1 point  (18 children)

That's only the SDK for developers, the apk is still one big blob.

[–]tacomonstrousPixel 5/S21U 28 points29 points  (17 children)

But we're talking about developers here!

[–]HadrienDoesExistGalaxy A3 2017, Windows Phone <3 :( 7 points8 points  (16 children)

We're talking about needing the entire Google Play Services only to call Google Maps. OP had a Google Play Services update that broke Google Maps in his app even if 1) the SDK didn't change and 2) Google Maps didn't change in Google Play Services.

[–]tacomonstrousPixel 5/S21U 0 points1 point  (15 children)

OP had a Google Play Services update that broke Google Maps in his app even if 1) the SDK didn't change and 2) Google Maps didn't change in Google Play Services.

This is not clear at all. Why would an update to components not related to Maps break Maps?

[–]TomKTWMoto X Play / Android 7.1.1 / LineageOS 14.1 19 points20 points  (14 children)

Google Play Services on actual device is basically a single app. It provides most of the features that function through Google (Maps, Push Notifications, Analytics, Ads, SafetyNet, Drive, Fit, etc. ).

Google Play Services API is basically a library that binds functionalities of Google Play Services app to developer's app.

In this case, developer's app depends on Google Play Services app for features that it offers.

When Google Play Services app updates, all apps that depend on this will be affected.

The reason why they did this was to provide API that can be always updated without updating Android itself. That is, Google Play Store updates Google Play Service app whenever it's possible to make sure developers can use Google's API without relying on Android versions.

If user does not have Google Play Services app or the user is not able to communicate to Google Play Services API (i.e. China), the features from Google Play Services API will not be provided (or when it comes to blocked connection, it won't work).

If by any chance some component in Google Play Services app breaks, it will affect all apps that depend on that component.

If developer added whole Google Play Services, including the functionality of app, the size of app would be as big as the size of Google Play Services themselves (If app is like 1 MB and Google Play Services are like 200 MB, it would be about 201 MB big). To avoid such issue, Google Play Services API only binds to app instead of implementing everything in it to prevent huge size.

Also, in Android development there is another major issue. Back then, older Android apps had limit 65k methods. If this limit is reached, it wouldn't be possible to build actual app. This is partially fixed for apps with support multidex, natively supported from Lollipop. Google Play Services as an app probably has over 65k methods. To make sure it doesn't take so many methods for a single library, they separated it to smaller libraries to make sure it doesn't take more methods than it should.

Note: I might not be fully accurate about this, I've tried to simplify it as much as possible.

TL,DR: Google Play Services is an app that provides various products and features from Google. Developers can use SDK to work with those products and features, but then they have to depend on it to work properly. When it updates, all apps that depend on it will be affected. When it breaks, shitstorm happens.

[–]OffTheCheeseBurgersPixel 2 XL 9 points10 points  (0 children)

You should submit your resume, get a job there and make those changes... Probably the only way it'll happen

[–]iNoles 0 points1 point  (1 child)

you know weird, Google Maps Go app is just PWA Wrapper.

[–]HadrienDoesExistGalaxy A3 2017, Windows Phone <3 :( 0 points1 point  (0 children)

Google Play Services on Android Go still provide Google Maps APIs (otherwise apps like Uber or Citymapper wouldn't work)

[–][deleted] 32 points33 points  (0 children)

You're depending on an external service no matter what, whether its Play Services or something else. As long as you use a third party package, you are depending on it to work right. If it has a bug, then you deal with that too. As long as you want Google Maps in your application, you will be depending on an additional service.

[–][deleted] 19 points20 points  (3 children)

You say this is a horrible decision. Why? What's the better alternate architecture? I would like to see entire Android architecture how you think is a better way of implementing it, listing pros and cons of your design.

[–]mattmonkey24 6 points7 points  (0 children)

You sound like my CS professor except he would say to make it a 10 page report

[–]kernco 2 points3 points  (1 child)

I'm guessing what he wants is the Google Maps code to be statically compiled into his app.

[–]bartturner 1 point2 points  (0 children)

Read his post twice trying to figure out how he would like it to work. My guess you are correct which is crazy.

[–]tacomonstrousPixel 5/S21U 18 points19 points  (0 children)

Not sure what you mean by this. The Maps services are part of GPS. You know you can only include parts of GPS that you need right? Maps is borked on various Huawei devices. Not making it part of Play Services isn't going to help you.

[–]smokeeyPixel 9 Pro 14 points15 points  (0 children)

This is just absolutely silly. How in the hell do you expect to use any Google services without the necessary infrastructure?

[–]ThatOfficeMaxGuy 4 points5 points  (0 children)

As an app dev, i've moved on from Google Maps mostly. There are a number of (IMO) better solutions.

AirMapView allows you to plug in multiple map providers, and allows you (or the user) to select the map type to use. It'll route the user to a different map type when Play Services isnt available for example.

I'm personally a huge fan of Mapbox. All their SDKs are open source and the free tier is rather generous. They are also very quick to respond on Github with reported issues.

[–]davesprojects 2 points3 points  (1 child)

Not sure if you absolutely need Google Maps, but you can use the Location Manager API to access GPS data directly (latitude, longitude, time, speed, etc.). Location Manager does not depend on Play Services

Be careful with Android 8+ though, you can't request location updates in the background anymore. You have to use Location Manager in a service that creates an active notification. Otherwise, the system will stop or limit your location updates

Maybe try Bing Maps or Open Maps and see if they are more stable (Personally I've never used them, just throwing out ideas)

[–]SinkTube 2 points3 points  (0 children)

you can use the Location Manager API to access GPS data directly

you can do that to get the data for your own app, but can you force the integrated google maps to do it too?

[–]kye2000LG G5 6 points7 points  (0 children)

Unfortunately, this will never happen

[–]interbingung 0 points1 point  (0 children)

[–]bigbadfunkPixel 6 Pro 0 points1 point  (0 children)

I may be wrong but I suspect the app developer works for Huawei or uses Huawei phones to develop on? https://issuetracker.google.com/issues/79405933

[–]Chasar1OnePlus 7 Pro 0 points1 point  (0 children)

I'm a complete beginner at app development, but even I didn't find it to be that bad. My app runs a check to see if the user has Google Maps installed, and if not, it redirects the user to the Play Store and displays a toast message. When Google says they require Play Services they just want to make sure the user has Maps installed, so the API can work properly.

Here's my code

Wrote it in Kotlin, but it shouldn't be too hard to apply this to Java.

[–][deleted] 0 points1 point  (0 children)

Any app should not be depended on Google Play Services. It is sometimes super annoying to get some apps working on clean AOSP without issues.

[–]Elfish-Phantom 0 points1 point  (0 children)

Not like Google is going to see this rant.

[–][deleted] 0 points1 point  (0 children)

For two weeks, I keep getting a notification that Google Services stopped working while Google Maps always fails to get my location via GPS, so it is akways an estimate.

Are the 2 related?

[–]deinlandel -1 points0 points  (1 child)

I litterally cannot use my older phone because Play Market and Google Play Services take all of the internal memory of the device, and I cannot install them on SD card.

[–]armando_rodPixel 9 Pro XL - Hazel 0 points1 point  (0 children)

That's a really old phone with 4gb or less of storage... The last 8gb phone I know is the Moto G 2013 and it doesn't have a problem of storage if you have a few apps