Prepare app for both app gallery and google play store

528 views Asked by At

Which is the best practice way to prepare app for both app gallery and play store release

Searching web i found few approaches:

-(1)using flavors (one for googlePlay and one for appGallery) each defining same boolean field "isHuawei" ( no for googlePlay and yes for appGallery flavor). Based on this boolean google play services are used or not

productFlavors {
    google {
        buildConfigField "boolean", "isHuawei", "false"
    }
    huawei {
        buildConfigField "boolean", "isHuawei", "true"
    }
}

-(2)adding in gradle for app gallery release :

project.gradle.startParameter.excludedTaskNames.add('processHuaweiReleaseGoogleServices')

Is there any inconvenience if this task is not run for huawei release?

-(3)the following code to find out if running on huawei (with no google play) or phones with google play

FirebaseMessaging.getInstance().token.addOnCompleteListener { task -> if (!task.isSuccessful) { noGMS } else { GMS }}

-(4)using

GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(nContext))

to find out if this build is for phone with GMS or not.

Using 1,3 and 4 from the above on app startup to find out if app is currently running o phone with or without GMS is a good practice? If all three returns false it can means that the application is running on a phone whitout GMS.

There are huawei phones that can have App Gallery and Google Play Store. How to manage appGallery relase for huawei phone running both stores?

1

There are 1 answers

0
Zinna On

To publish your app in AppGallery on Huawei phones, you will meet two situations:

  • App runs on Huawei phones with both GMS(Google Mobile Service) and HMS (Huawei Mobile service)
  • App runs on phones with only HMS (Huawei Mobile service)

If you want to use one APK for both situations: To guarantee your app works on both Huawei phones with GMS+HMS and Huawei phones with only HMS, you can use 1, 3,4 mentioned in your post to tell if the phone is a GMS phone or HMS phone and handle the situation differently in your code. The reason is that: on Huawei HMS-only phones, it does not have GMS to support some of the Google SDKs like IAP, Map, etc. You will need to integrate Huawei HMS IAP, Map, etc. SDKs in your app so to make it work.

You can find all the detailed HMS SDKs info. here: https://developer.huawei.com/consumer/en/hms

Or for complicated business logic and to support future API changes (including deprecation), you can have two code bases: one APK with HMS SDKs integrated for Huawei phones with only HMS and one APK for Huawei phones with both HMS and GMS. This also means you will need to use a different package name and key for the APK you submitted in Huawei AppGallery. This will help to avoid the update conflicts with the version in the Google play store.