Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Will react native work without Google Services on Huawei phone?

Soon new Huawei phones will stop supporting Google Play and Google Mobile Services.

Huawei is preparing its own ecosystem called HMS https://developer.huawei.com/consumer/en/service/hms/developer.html

Their app store is called "Huawei App Gallery" and has its documentation here: https://developer.huawei.com/consumer/en/doc/30202

They are now sending messages to developers (including me) that encourage them to release an app to their store. They are claiming that they only need an APK file and no changes to the application are needed.

My questions are:

  • Is a react-native app going to work without code changes?
  • Is Firebase SDK going to work?
  • What is the real hidden cost of maintaining an app in another Android ecosystem?
like image 619
Maciej Sawicki Avatar asked Oct 30 '19 18:10

Maciej Sawicki


4 Answers

Huawei has already released its Huawei Mobile Services and is currently progressively updating its services to closely match with Google and Apple. As for the questions your asking

  1. Is the react-native app going to work without code changes?

Yes, as long as you can generate an apk to upload to their Huawei App Gallery. You do not have to make any code changes.

  1. Is Firebase SDK going to work?

This depends on the type of service you are trying to incorporate into your application for instance if your trying to use Google Login using the authentication module provided by Firebase then it will not be supported only on the phones that do not include GMS (Google Mobile Services) which is the Huawei Mate 30 Pro.

However, if you are looking at notifications. Google has Firebase Cloud Messaging and Huawei has its Huawei Push Notification. You can use either one as this is dependant on the architecture of the backend services and will be supported on all android devices.

  1. What is the real hidden cost of maintaining an app in another Android eco-system?

This completely depends on how you architect the system and the services that are required within your application. Let say you want to include Huawei Sign in to be incorporated within your application and you also need to include HMS, But these you want to maintain in the Huawei App Gallery and For Google you have FCM and Google Login and Maps implemented then you would have to maintain two different branches which share the common core functionality which is time and cost consuming.

If the app is just going to use only the bare functionality which is purely dependant on logic and very little or no GMS/HMS, then you do not have to maintain separate branches for your project, just one would suffice. You just need to submit a version to your Google Play Publish and Huawei App Gallery.

If you would like to use a single repo for both GMS and HMS then you have to check the service available to enable the functionality.

For GMS

val gmsAvailable = GooglePlayServicesUtil.getInstance().isGooglePlayServicesAvailable(mContext)

For HMS

val hmsAvailable = HuaweiApiAvailability.getInstance().isHuaweiMobileServicesAvailable(mContext)

So when trying to use Google Login or Huawei Login or any other services, It would be.

if gmsAvailable {
   // execute GMS Code
} else if hmsAvailable {
   // execute HMS Code
}

Note* The above code is in Kotlin

like image 162
dilipkumar4813 Avatar answered Oct 20 '22 05:10

dilipkumar4813


Huawei has begun to build an HMS ecosystem to make top apps available on its new devices without access to GMS, such as Mate 30 and P40 devices, improving user experience on these devices. It is recommended that you use GMS if the device has access to GMS and use HMS if the device has no access to GMS.

As for your questions:

1.

Is a React-Native app going to work without code changes?

If your app uses any GMS plugins for React Native, such as Google Sign-in and Firebase Cloud Messaging, your app may not work properly on devices without access to GMS. Therefore, you need to make some code changes to your app. Huawei has provided some HMS Core kit plugins for React Native. For details, visit the following links:

  • Push Kit plugin for React Native

  • Analytics Kit plugin for React Native

  • Location Kit plugin for React Native

  • Map Kit plugin for React Native

  • Health Kit plugin for React Native

Is Firebase SDK going to work?

This depends on which GMS service you use. For example, if your app uses the push notification/Location/map service of GMS, your app may not work properly. In this case, you need to use relevant HMS SDK instead. You can choose what HMS Core services to use.

3.

What is the hidden cost of maintaining an app in another Android ecosystem?

There indeed some hidden workload, for example, maintaining code, releasing your app to HUAWEI AppGallery, and modifying both GMS and HMS to provide new functions. Of course, this depends on the complexity of your app. If your app uses many GMS services, the workload is relatively high. If your app uses few GMS services, the workload is relatively low. To reduce your workload, you are advised to use both GMS and HMS in your project. The method is as follows:

Check whether the device supports GMS

Check whether the device supports HMS

In your app, you can use the following pseudocode to use both GMS and HMS:

if isGMSAvailable {
   // execute GMS Code
} else if isHMSAvailable {
   // execute HMS Code
}

By doing so, you can reduce subsequent workload for maintaining code and adding new functions.

like image 33
shirley Avatar answered Sep 23 '22 03:09

shirley


Huawei has begun to build an HMS ecosystem to make top apps available on its new devices without access to GMS, such as Mate 30 and P40 devices, improving user experience on these devices. It is recommended that you use GMS if the device has access to GMS and use HMS if the device has no access to GMS.

As for your questions:

1.

Is a React-Native app going to work without code changes?

If your app uses any GMS plugins for React Native, such as Google Sign-in and Firebase Cloud Messaging, your app may not work properly on devices without access to GMS. Therefore, you need to make some code changes to your app. Huawei has provided some HMS Core kit plugins for React Native. For details, visit the following links:

  • Push Kit plugin for React Native

  • Analytics Kit plugin for React Native

  • Location Kit plugin for React Native

  • Map Kit plugin for React Native

  • Health Kit plugin for React Native

Is Firebase SDK going to work?

This depends on which GMS service you use. For example, if your app uses the push notification/Location/map service of GMS, your app may not work properly. In this case, you need to use relevant HMS SDK instead. You can choose what HMS Core services to use.

3.

What is the hidden cost of maintaining an app in another Android ecosystem?

There indeed some hidden workload, for example, maintaining code, releasing your app to HUAWEI AppGallery, and modifying both GMS and HMS to provide new functions. Of course, this depends on the complexity of your app. If your app uses many GMS services, the workload is relatively high. If your app uses few GMS services, the workload is relatively low. To reduce your workload, you are advised to use both GMS and HMS in your project. The method is as follows:

Check whether the device supports GMS

Check whether the device supports HMS

In your app, you can use the following pseudocode to use both GMS and HMS:

if isGMSAvailable {
   // execute GMS Code
} else if isHMSAvailable {
   // execute HMS Code
}

By doing so, you can reduce subsequent workload for maintaining code and adding new functions.

like image 3
zhangxaochen Avatar answered Oct 20 '22 04:10

zhangxaochen


Regarding:

Is Firebase SDK going to work?

You could use this service from Huawei called QuickHMS - you simply search for a dependency/framework/library and find out if it can run as it is on HMS devices: https://quickhms.com/en/compatibility-check/

The list of current ReactNative HMS plugins can be found here: https://developer.huawei.com/consumer/en/doc/development/HMS-Plugin-Library-V1/reactnative-plugin-0000001050155850-V1

like image 1
Adi B Avatar answered Oct 20 '22 05:10

Adi B