Skip to content

Publishing to AppGallery🔗

To use MRGS in apps published to Huawei AppGallery enable HMS support in MRGS.

HMS support is an additional behavior for existing MRGS modules (MRGSBilling, MRGSNotifications). Therefore, it is enough to set the billing type during the configuration and initialization of the MRGS SDK to HUAWEI to use that behavior.

Huawei Store

Huawei devices no longer ship with Google Services, so user authentication via Google Play and Firebase Analytics won't be available on them.

Supported modules🔗

Current version of MRGS features HMS support in following modules:

  1. Huawei Advertising ID (MRGService module).
  2. Huawei In-App Purchases (MRGSBilling module).
  3. Push notifications via Huawei Push Kit (MRGSNotifications module).

Setting up a project🔗

  • To register an application in App Gallery follow the instruction
  • Register your app on MRGS site with "Huawei" in Platform field:

huawei_mrgs_app

Bundle ID field must contain the application package name. Fill External ID with value from the Huawei Console (see below):

huawei_external_id

Setting up HMS🔗

  • When initializing MRGService SDK configure the correct billing type. This will affect the rest of modules.
using MRGS;

public class MasterController : MonoBehaviour
{
    void Awake()
    {
        var serviceParams = new MRGServiceParams(appId: APP_ID, appSecret: APP_SECRET);
        // Setting MRGServiceParams
        // ...

        // Requires Platform for Android application
        // Available platforms: Amazon, Android, Huawei, Samsung, FacebookCloud, RStore
        serviceParams.AndroidExtraOptions.Platform = MRGSPlatformAndroid.Huawei;

        // Settings external SDK and initializing MRGS SDK
        // ...
    }
}
import games.my.mrgs.MRGSPlatform;
import games.my.mrgs.MRGService;
import games.my.mrgs.MRGServiceParams;

public class YourApplicationClass extends Application {
    @Override
    public void onCreate() {
        super.onCreate();

        // Setting MRGService
        // Available MRGSPlatform: AMAZON, ANDROID, HUAWEI, SAMSUNG, FACEBOOK_CLOUD, RSTORE
        final MRGServiceParams serviceParams
                = MRGServiceParams.init(<MRGS_APP_ID>, <CLIENT_SECRET>, MRGSPlatform.HUAWEI)

        // Settings external SDK and initialization MRGS SDK
        // ...
    }
}

Add required HMS modules to dependencies.

MRGS uses following HMS modules to identify devices/users and perform in-app purchases:

  • com.huawei.hms:opendevice — see the docs.
  • com.huawei.hms:ads-identifier — see the docs.
  • com.huawei.hms:iap — see the docs

Using Huawei Push Kit to receive notifications🔗

Java/Android

Instruction

Unity

Instruction

Make sure to configure the secret key to receive your notifications.

Payments support🔗

Configuration of MRGSBilling module is described in separate document.


Last update: 2025-01-21
Created: 2024-01-09