How Rakuten Viki Built its Google Play Instant App Back in 2016

Julius Uy

Just last week, news broke out that Twitter is shutting down Periscope. This left a rather sobering reminder that paranoia in perpetuity is perhaps the only surest way to survive a dog-eat-dog world. Periscope was huge back then. Though not a user myself, I was a fan of how they were one of the first to put out a Google Play Instant version of their app and made it to Google I/O 2017 to talk about their experience.(henceforth, I’ll use Android Instant App to refer to Google Play Instant, which was the original nomenclature for the feature).

In this article, I’ll share what it was like when we worked on Android Instant App at Rakuten Viki.

The Viki team at Google I/O 2016, when Android Instant App was announced
The 66 apps initially slated to launch with Instant App functionality

While Instant App looked cool, it was never really in our radar. In our flight back to Singapore, there’s one thing that’s running in my mind, a feature that was also announced in the conference. I’m thinking…

Can we build a Viki app for Google Daydream and transpile it to support HTC Vive, Oculus Rift, and Playstation VR?

Anyway, back in Mountain View, I had a long chat with one engineer from the Daydream team to get an idea on how we can build Viki on it. After thinking about it and working on the first iteration of the Daydream SDK, it turned out to be too complex and risky, so we dropped the idea.

We sat down with the PMs and decided that it’s worth a shot to experiment on this. So we started a conversation with Google and we got into the Early Access Program on August 1. Here’s where the insanity begins.

Google told us that they’ll be launching Instant App on August 15. That means we only have two weeks to get our app ready. You can imagine how insane this was with only two engineers and mounting tech debts.

The Road to Instant App Compatibility

Next, we had our image files compressed with tinypng. That effectively shaved off quite a sum as well. We also noticed that font files were taking up around 1.5 MB of storage space. Remember, this was also a time when downloadable fonts were not yet supported. So we went to the design team and begged them to let us remove these custom fonts. They said yes.

By the way, in the early days of Android Instant App, ProGuard was NOT supported. Hence it spawned blogs like this which of course, Google fixed nicely several iterations later. Without ProGuard, you don’t have a means to minify your application either. This could have helped us quite a bit but anyway, this is something we have to live with.

At that point, we were still at around 5.5 MB. Without any assets or resources left to remove, we were now reduced to asking ourselves, what are the core features that need to remain?

From 5.5 MB to 4.15 MB

With that, we are still 700 KB above the size limit. We then decided to remove every other language support apart from English. The argument was that Instant App will first launch in the US, which is largely English speaking. This saved us a further 200 KB or so.

Back in 2016, we support devices all the way back to Android 4.0, which means that we need Android’s Native MediaPlayer (ExoPlayer only supports Android 4.1 and above). However, because Instant App is only supported on Android 4.1 and above, we could remove all the MediaPlayer related code and latch on to ExoPlayer fully. So remove we did. It saved us a further 100 KB.

At Viki, we used to work with three video ad providers: Google’s IMA, Facebook Audience Network (now defunct), and Tremor (also now defunct). We decided that we really need the ad revenue from Instant App now that subscription is gone. At this point we had to choose. We decided to remove Facebook Audience Network and Tremor. That effectively shaved around 250 KB or so. We’re almost there at 4.15 MB!!

The Last Mile

We looked at the file size: 3.98 MB. WE DID IT!!! That was around August 11. I threw myself back on my chair. Sigh of relief. We’re done. We can launch on August 15!

Launch Day: August 15, 2016

August 16, 2016. No news.

August 17, 2016. No news either.

It turns out, Android Instant App launch was deferred to October 17. At that point, partners are dropping off left and right. Android Instant App initially had 150 developers in the program. Our DevRel told us that Viki was the first (or second) to become Instant App compatible. Of course, my tail was wagging. It was not the cleanest codebase, as the subsequent Android engineers who joined us could attest. But it was good enough to get our foot in the door. This is tremendous because Instant App was the genesis that really put us on Google’s radar. Here we are, an obscure Singapore based engineering team with so little resource serving a niche market and found ourselves to be the only App written in this side of the world to be Instant App compatible.

January 24, 2017

Viki became the poster child of Instant App in several workshops such as one which Google held in Hong Kong, Tokyo, and several other places. Viki showed up in commercials, Google Play Movies integration, and others. Here’s me playing with our Instant App at the Android booth.

A Google Play Movies integration with Viki

Fast forward to 2019, we finally had the chance to share how we did Instant Apps to the community. My colleagues from the Viki Android team spoke about this at Android Day. Interestingly enough, I never really had a chance to speak about this in public. The reason being that the 2016 SDK of Android Instant App is nothing like that which exists today. At this point, there’s no value to talk about an SDK that’s already been replaced twice.

An out of shape Asian slob finally meeting the team behind Android Instant App

Always Invest Time to Clean Up Tech Debt

Dare to Try, Dare to Fail

Always Be Learning

I have to say that working on Android Instant App was one of the most fun time I had as a Software Engineer. It was new, it was crazy, but it was lots of fun. Today, the entire team at Viki who were involved with the original Android Instant App has since moved on. Yet, I’ll look back to that day time and again. It is certainly a feat worth remembering.

_____

¹ This is largely thanks to the Product Team, especially to Alex Chan, and Lizzie Zhang, who were very much instrumental in partnering with the engineering team to get all these bottled up ideas out the door.

² By the way, I couldn’t post screenshots because I’m writing this long after I graduated from Rakuten Viki. I don’t have access to the source code anymore and am only writing based on my recollection.