Reacting to Google Play Services- 1 min
Google Play Services (PS) is an awesome library and every Android developer needs it. It makes location super easy, allows you to use the G+ sign in button thingy to forget about passwords, figure out what you’re doing using Google Fit, etc…
Of course there is a but.
It’s implemented in a certain way that ties you to the Google Play ecosystem. Sure, you’ve got your flavo(u)rs that allow you to publish to Amazon, Yandex and about a million of other app stores out there. But how does that help you when you need to rewrite the entire bloody app because all of it is so tightly coupled to PS?
Also there is this little issue of testing code with such heavy dependencies.
See, PS is designed to be tightly coupled. Here’s when you’d normally whine about Google being shit to devs but there’s already to much of that around. As in - a third of /r/androiddev.
Thing is, the Google, they ain’t a changin’. The docs are a mess and someone decided to implement every single thing against Uncle Bob’s principles of Clean Code.
Hence, I started wrapping it around my new favourite toy in the arsenal, RxJava’s observables. Idea was, we needed a single location update in our app at M&S. If only we were able to just subscribe to location updates and then only grab the first one.
getLocationUpdates(locationRequest).first().subscribe( new OnCompleteAction(), new OnErrorAction());
RxJava was built for that sort of shit.
We’re still in the very early stages of development, and are simultaneously fighting with Android Studio’s new unit testing support.
More coming soon. I hope.