我在Google Play商店中有一个应用程序。我打算也将其发布在华为商店中。
除了使用华为SDK和基本的指导步骤(添加到项目agconnect-services.json等)重建应用程序外,是否还需要在代码级别进行其他更改?
所有API都正常吗?特别是那些与应用内购买有关的内容?
谢谢
首先,请查看您使用的GMS套件,我可以为您提供相应的HMS套件。您也可以参考此答案。
在代码级别,如果您想:
public boolean isGMS(){
return GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(this) == com.google.android.gms.common.ConnectionResult.SUCCESS;
}
public boolean isHMS(){
return HuaweiApiAvailability.getInstance().isHuaweiMobileServicesAvailable(this) == com.huawei.hms.api.ConnectionResult.SUCCESS;
}
代码调用的逻辑:
If ( isGMS() ) {
//GMS code
}else if ( isHMS() ){
//HMS code
}
HMS提供与GMS相似的界面。这是IAP文档和Github。
您也可以使用HMS ToolKit来实现G2H / G + H。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句