Home > Net >  Excluding packages based on product flavor to support GMS & HMS independently
Excluding packages based on product flavor to support GMS & HMS independently

Time:01-12

In order for my application to be approved and visible on both of Google Playstore and Huawei App Gallery, I am currently maintaining two different branches:

  • Google branch which has react-native-maps installed but no hms packages.

  • Huawei branch which has hms maps installed but not react-native-maps.

(I'm aware of the HMS GMS approach, but having both together means that the app won't be visible on HMS only devices)

Both branches have the same code on the JavaScript side except one file which is used to display the map.

My question is: is there a way to dynamically exclude some files and packages in build time based on the product flavor?

My goal is to be able to use one codebase for those 2 versions of the app without having to keep adding and removing packages and doing manual edits before building.

Edit: I have already tried the GMS HMS approach, but when using this approach, Huawei's newest phones that are HMS only are not able to see my app on the Huawei app gallery.

CodePudding user response:

First of all, Huawei does support react-native-maps. Please check here: enter image description here

  • Check that GMS is available enter image description here

There are also some links for your reference:

React Native Application Detect device support GMS or HMS: enter image description here

And run the following command:

enter image description here

  •  Tags:  
  • Related