Creating world-class developer experiences!
It was a traditionally busy Wednesday morning (don’t ask, they just are) when the email from Storytel dropped into the Dev Portal in-box. They had been building an Android Automotive app using our Emulator and were about 95% percent of the way there. But they had questions. Ash (the Developer Portals in-house Android Automotive Expert) had seen it as well and slacked me — we Slack even though we sit next to each other — “This is actually really cool. Why don’t we invite them in to test on a real car? And besides, what are they actually missing?”
So that started the mission to get 700,000 audio books into the car and find the missing 5%.
But, back to the beginning:
Android is known for providing the best ecosystem for its developers. And their emulators simulate android devices on your computer so that you can test your application on a variety of devices and Android API levels without needing to have each physical device.
But there are plenty of device options to develop on, and the challenge here is to develop for a completely different category of devices, cars, which are literally one of the world’s most complex devices. And the remote developers be like,
So, to try and make life easier for the developers, we have our own Android Automotive Emulator which perfectly mirrors the functionality, look, and feel of our newer Android equipped cars.
When we talked to Micke (Storytel’s Director of Product), he said that he found it useful to quality assure the app before releasing it, saving a LOT of time. Another advantage was the fact that our emulator is in portrait mode, to mirror the screen in the car — and the standard emulator is in landscape. There is a whole other discussion to dive into as to why we did this. But the simple answer is “because it’s better” .
With that in mind, I asked Ash to try and sum up what he thought was good about the emulator:
The first thing echoes what Micke said: this has realistic dimensions and controls so, if you pretend a bit, it can be just like testing it in a real car.
- There are all kinds of other inputs that you only get in a car, that make it a unique experience (phones do not have climate control or a speedometer, for example)
- With these inputs you can actually simulate the conditions in the car on the road. For example: How does my app behave at 100KPH with low fuel? (You never know…)
- Since we are a car company, we do care about performance, And the Emulator has been tested for impressive performance with CPU virtualisation enabled.
- This also comes with a complete with Google services. The emulator is packed with preloaded apps including the Google Play Store so whatever you develop looks the same in testing as it does in the real car. OH YEAH! And with the Play Store you can install any other app to play with whilst you build your own.
On a fun additional note, you can also sideload your specific APKs into this emulator and test fun scenarios like the one I did, by installing Netflix onto my emulator and binged a series whilst I code my other project in the side monitor.
The ease of developing part has been lingering in my mind for quite some long time and I wanted to test it out. So rather than disturbing Ashwin, I just plugged in my air pods and started developing apps in my free time. You might have some doubts, but trust me, it just took 6 minutes to do my hello world in the car* (I mean with some asterisks and conditions apply like having your Android Studio already installed).
*Balaji is a massive geek — Balaji’s Boss
I would love to share them here and call this chapter — Adam to Android (The theory of android hello world in car) . There are thousands of tutorials available on the internet on how to develop an android app from scratch, but this is how to develop for cars! So try this, and in a few* minutes you could build your first app for a car.
*Dependant on Balaji levels of Geekery
Time starts here 0:00:00
- Start like Adam — with just sticks in hand (Android Studio) start playing with it! Get your preconditions right -> Android Studio is greedy, and a powerful machine is usually preferable
Assuming you have it preinstalled, still it will not take more than a minute to install it on your machine.
Time update 0:01:00 — Sharp!
- Open new project in the android studio -> select automotive in the templates -> enter the app basic details like the name and location.
Time update 0:01:40 — Honestly
- The app gets created and you can see two important folders, APP and RES — All code and resources reside here.
- MainActivity inside the APP contains the actual code of the activity the user sees, which also initialises app-wide resources.
- Activity_main inside the RES holds the resources such as layouts, strings, images. And our activity is associated with this layout of UI views defined as an XML usually. There are many other ways to build an app but let us check our time before that!!
Time update 0:03:58 — That’s a costly step!
- Now comes the VoooLVoooo Moment, provided you have followed the steps here https://developer.volvocars.com/android-automotive/sdk/, you can see the Volvo XC40 in the virtual device AVD Manager available in the tools.
- Select that in the Run -> select device and just RUN the app!!
- Hope it RUNS!
My hello world is here,
Time update 0:05:55 — Ufff, close!
Tada! Your hello world for car app is BOOM right in front of your eyes!
That was easy but creating more extensive applications usually require a bit more work, but it’s definitely doable!! Which brings us back to Storytel. Because we were so impressed (and we were still intrigued by that missing 5%), we invited them down to try it out in a real car. It was a really fun day for both sides. It was great for us to see how people had used our tools to build an impressive app, and they really enjoyed the experience of seeing their app go from the emulator into a real car. It is also nice to be able to bring like minded folks in to experiment with our test cars and rigs — and they were jealous of Ash’s set up (Imagine a disembodied infotainment screen wired up to a beast of a Linux tower).
But whilst it was indeed a fun day, the Storytel team did have some useful feedback as to our missing 5%:
- Please fix the Emulator support for my M1 chipset, as it currently only supports Intel Chipsets.
- The DI (Driver Information Cluster), the thing we see behind the steering wheel, is missing from the emulator. Can we update the OS to Android 11?
Software’s strength lies in its updates! With every different developer we interact with, we realise there are unique requirements and wishes to fulfil in making their experience better, especially for automotive. That may have tended to take it for granted or we might not have met with that before, such developer experiences like Storytel made us aware that we will work on getting even better at releasing updated top industry standard emulators, with more examples and explanations on how it is to develop for cars on our portal in the future.
Stay hungry, stay foolish and start coding with us on our Developer Portal today!!