在华为手机上没有Google Services的情况下是否会响应本地工作? [英] Will react native work without Google Services on Huawei phone?

查看:165
本文介绍了在华为手机上没有Google Services的情况下是否会响应本地工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很快,新的华为手机将停止支持Google Play和Google移动服务.

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

华为正在准备自己的称为HMS的生态系统. https://developer.huawei.com/consumer/en/service/hms/developer.html

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

他们的应用程序商店称为华为应用程序库",并在此处提供其文档: https://developer.huawei.com/consumer/zh/doc/30202

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

他们现在正在向开发人员(包括我)发送消息,鼓​​励他们向其商店发布应用程序.他们声称他们只需要一个APK文件,不需要对应用程序进行任何更改.

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.

我的问题是:

  • 无需更改代码即可运行本机应用程序吗?
  • Firebase SDK是否可以正常工作?
  • 在另一个Android生态系统中维护应用程序的真正隐藏成本是什么?

推荐答案

华为已经发布了华为移动服务,目前正在逐步更新其服务以与Google和Apple紧密匹配.至于你问的问题

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. 无需更改代码即可在本机应用程序正常运行吗?

,只要您可以生成一个APK即可上传到他们的华为应用程序库.您不必进行任何代码更改.

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. Firebase SDK是否可以正常工作?

这取决于您尝试将其整合到应用程序中的服务类型,例如,如果您尝试使用Firebase提供的身份验证模块来使用Google Login,则只有不包含GMS的手机不支持该服务(Google Mobile Services),即Huawei Mate 30 Pro.

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.

但是,如果您正在查看通知.谷歌有Firebase Cloud Messaging,而华为有其Huawei Push Notification.您可以使用任何一种,因为这取决于后端服务的体系结构,并且将在所有android设备上受支持.

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. 在另一个Android生态系统中维护应用程序的真正隐藏成本是什么?

这完全取决于您如何构建系统以及应用程序中所需的服务.假设您要在应用程序中包含Huawei Sign in,并且还需要包含HMS,但是要在Huawei App Gallery中维护这些内容,对于Google,您需要实现FCM,Google Login和Maps维护两个不同的分支机构,它们共享共同的核心功能,这既耗时又耗费成本.

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.

如果该应用仅使用仅依赖于逻辑且几乎没有或完全没有GMS/HMS的裸功能,那么您不必为项目维护单独的分支,只需一个就足够了.您只需要向Google Play Publish和Huawei App Gallery提交一个版本.

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.

如果您要对GMS和HMS使用单个存储库,则必须检查可用的服务以启用该功能.

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.

对于GMS

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

对于HMS

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

因此,当尝试使用Google Login或Huawei Login或任何其他服务时,应该是这样.

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
}

注意*上面的代码在Kotlin中

这篇关于在华为手机上没有Google Services的情况下是否会响应本地工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆