2

I've been reading the huawei's documentation to implement their services.

The documentation is easy and clear, but I have a few doubts.

Huawei's SDK can exist in the same apk for both stores? or I need implement a different apk for gms and hms?

If I implement hms how can I know if hms is reading data from other devices like MOTO etc.

Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
memoadian
  • 209
  • 3
  • 14

3 Answers3

2

You can use both of HMS and GMS services. Some of HMS service support to non-Huawei devices (like Scan Kit) and some of kit tighlty bound the EMUI and Huawei phones.

If you need to apply you already created applıcation moved into HMS ecosystem, you can use HMS Toolkit and quickly implemented HMS services. (details)

Sezer BOZKIR
  • 534
  • 2
  • 13
1

Huawei's SDK can exist in the same apk for both stores?
- yes, you can create one app and implement libraries for GMS and HMS.

If I implement hms how can I know if hms is reading data from other devices like MOTO etc.
You call functions from Google's or Huawei's responsible for detecting services.

Please check out my latest answer from here: https://stackoverflow.com/a/60587678/619673

deadfish
  • 11,996
  • 12
  • 87
  • 136
1

There are a couple ways to handle this. Of course you can choose to maintain 2 sets of source code, which is highly not recommended, and you can choose to keep libraries from both sides, detect which service is available and call them accordingly. I would however recommend implementating different product flavours and build your product according to the platform.

android{
flavorDimensions "default"
 productFlavors{
     hmsVersion{
         //select the dimension of flavor
         dimension "default"

         //Configure this flavor specific app name published in Huawei App Gallery
         resValue "string", "flavored_app_name", "App name"
     }
     gmsVersion{
         //select the dimension of flavor
         dimension "default"

         //Configure this flavor specific app name published in Play Store
         resValue "string", "flavored_app_name", "App Name"
     }
 }
}

and then you can do something like this

// HMS Flavor
 hmsVersionImplementation 'com.huawei.hms:hianalytics:4.0.3.300'

 // GMS Flavor
 gmsVersionImplementation 'com.google.firebase:firebase-analytics:17.4.0'
clementf
  • 21
  • 1