I have an application live in Google Play Store. I am planning to publish it also in Huawei Store.
Apart from re-building the app with the Huawei SDK and the basic instructed steps (Add into the project agconnect-services.json etc..), is there something else that needs to be changed at code level ?
Are all APIs working ? Specially those related to in-app purchases ?
Thanks
First, please check out what GMS Kit you are using, and I could provide you corresponding HMS Kits. You can refer to this answer as well.
At code level, if you want to:
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;
}
The logic of the code invoking:
If ( isGMS() ) {
//GMS code
}else if ( isHMS() ){
//HMS code
}
HMS provides interfaces similar to those of the GMS. Here are IAP documentation and Github.
You can also use HMS ToolKit to implement G2H/G+H.
Update:
You can use the following code to obtain productId:
PurchaseResultInfo buyResultInfo = Iap.getIapClient(this).parsePurchaseResultInfoFromIntent(data);
The getInAppPurchaseData() method is called through the buyResultInfo object declared by PurchaseResultInfo. You can obtain InAppPurchaseData after the getInAppPurchaseData method is successfully called.
The product ID of the current transaction is stored in InAppPurchaseData. See: here.