Migrating app to Huawei AppGallery
AppGallery — an alternate market for Android phones has started to grow faster and the new Huawei phones are still the choice of the customers. It means we had to adapt to the new market and make app users happy.
Users with the new Huawei phones which came with HMS only had 2 options: either not to use their favorite mobile bank application or install Google Play services manually and void the warranty, which is not the best option to offer to the user. So we decided to fix this as soon as possible and handle it as a normal case, not like the something needed hotfix.
Many financial applications use Google Services for various services, like:
- QR code scanner for payments/withdrawal
- Security features and reporting
- Analytics and notifications
- Map of ATMs and branches
Without those features application is incomplete and security is at risk. Not all dependencies require Google Play services, for instance, Firebase has a chart with the following categories: not required/required/recommended. https://firebase.google.com/docs/android/android-play-services
Of course, there are other options as well and one can freely rely on the services which are not locked to Google services, like OpenStreetMaps for maps obviously, etc.
Out customers use devices that run:
- Google services only
- Google services + Huawei services
- Huawei services only
To cover all the cases we were missing the last part — supporting devices with the Huawei services only. Our mobile bank team estimated changes, started building and changing the infrastructure around them.
We were already using flavors and decided to add one more “store” flavor — “google” and “Huawei”. For the Google Play release, we excluded any Huawei-related dependency to make it compatible with the Play Market. For Huawei releases, we kept some Firebase dependencies which does not require Google Services. During the migration, we felt that Huawei docs are quite good and well written, pretty straightforward, and gives you direct hints.
HMS libraries' public API are almost 1:1 identical to Google libraries so expect fewer changes in method invocations. Because of this reason, the whole refactoring of the application was relatively smooth, the aforementioned flavors helped us to utilize the correct dependencies. 95% of our features are platform-independent remaining 5 is the most crucial.
The story continues to build processes and CI/CD. We ended up creating a separate pipeline for Huawei-specific builds and providing separate test builds for QA. This created an extra build step and artifact as a result but in return, the app works flawlessly on the devices with HMS only.
What did we find along this journey?
The “agconnect” plugin is a kind of sensitive dependency, always needs to be up to date to work with the latest Gradle plugin and merge manifests correctly.
For testing prefer a real device, otherwise, you will have a hard time. To emulate a system without GMS and Play Store one can set up a plain system image in emulator but GMS need an ARM-based processor, like all Huawei phones, so either set up an ARM emulator and expect 10x performance degradation or request a Huawei test device or find any rooted phone and flash it with some clean OS without GMS and then install HMS.
Publishing the application on AppGallery is easier than Play Store but the experience with the console is not as satisfying and complete as the Google one.
Check out our mobile bank: