Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

370
Visualizações
Select GMS or HMS for android apps

I have an android app , that i need to deploy for both Google play and App gallery

and it contains Ads and IAP , the problem is that

1- What is the correct way to handle the ads/purchase ?

 if hmsAvailable() {
    // use Huawei ads/iap 
 } else {
    // use Google ads/iap
 } 

2- I need the same code base ,so Would it cause a problem to have both GMS and HMS inside Gradle.build ?

3- It seems that Huawei is about to prevent GMS installation on it's devices , so if a user has paid the premium IAP with a google account , would this means he can't restore it when GMS is blocked on Huawei ?

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

I don't hear anything about blocking GMS by Huawei, but hear about blocking apps on google play if they have Huawei SDKs.

So, you should choose this way:

Create different flavors for different stores and include huawei/google libraries only for huawei/google flavor.

And yes, to restore iaps on different devices with different stores you have to store purchases info on your own server, not rely on response from store.

over 4 years ago · Santiago Trujillo Relatório

0

1- What is the correct way to handle the ads/purchase ?

You can make a judgment, but it is recommended that Google Play and App Gallery integrate their own Ads and IAP SDKs, and include Huawei and Google libraries.

2- I need the same code base ,so Would it cause a problem to have both GMS and HMS inside Gradle.build ?

On Google Play, only apps integrated with the Google IAP can be released. If the apps integrated with the HMS, the apps cannot be released.

There are no restrictions on Huawei App Gallery.

3- It seems that Huawei is about to prevent GMS installation on it's devices , so if a user has paid the premium IAP with a google account , would this means he can't restore it when GMS is blocked on Huawei ?

It is not that Huawei prevents the installation of the GMS, but that the GMS cannot be installed on Huawei devices.

over 4 years ago · Santiago Trujillo Relatório

0

  1. You can define product flavors or check for GMS/HMS availability inside the code itself. GMS+HMS Product Flavors https://stackoverflow.com/a/61839463/14880637

    gms { dimension "services" buildConfigField "String", "SERVICE_USED", '"g"'

     }
     hms {
         dimension "services"
         buildConfigField "String", "SERVICE_USED", '"h"'
     }
    

GMS/HMS Availability Check https://stackoverflow.com/a/60587678/14880637

public static boolean isHmsAvailable(Context context) {
    boolean isAvailable = false;
    if (null != context) {
        int result = HuaweiApiAvailability.getInstance().isHuaweiMobileServicesAvailable(context);
        isAvailable = (com.huawei.hms.api.ConnectionResult.SUCCESS == result);
    }
    Log.i(TAG, "isHmsAvailable: " + isAvailable);
    return isAvailable;
}

public static boolean isGmsAvailable(Context context) {
    boolean isAvailable = false;
    if (null != context) {
        int result = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context);
        isAvailable = (com.google.android.gms.common.ConnectionResult.SUCCESS == result);
    }
    Log.i(TAG, "isGmsAvailable: " + isAvailable);
    return isAvailable;
}
  1. There is no issue with having both GMS and HMS in the gradle. ChoiceSDk is a good example which in use by published apps. https://www.hihonor.com/global/club/topicdetail/choice-sdk-gms-to-hms-apps-for-huawei-appgallery/topicId-69134/ You can see that ChoiceSDk requires both GMS and HMS configuration in the gradle. https://github.com/bluesource/ChoiceSDK

  2. Huawei is not blocking GMS on their devices. Google has blocked GMS access to Huawei phones released after May 2019. https://www.pocket-lint.com/phones/news/huawei/148102-what-does-huawei-s-google-ban-mean-for-your-huawei-or-honor-phone. Because GMS is not available on Huawei phones released after May 2019, it will not be possible to access Google IAP from those devices. It's recommended that you store purchase history on your own server to ensure that users will still be able to access their premium purchase.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda