Intelligent Assistant
Chat with our virtual assistant to get answers promptly.
The AppGallery Connect React Native plugin applies only to the Android and iOS platforms.
AppGallery Connect provides you with various development services in terms of building, quality, growth, and HUAWEI CLOUD. The development process of an AppGallery Connect service is as follows:
Some services in AppGallery Connect involve app data processing. Before using these services, you need to set a data processing location.
Currently, only some AppGallery Connect services provide a React Native plugin. You need to integrate a React Native plugin to your development environment before using any of the following services:
To free you from complex configurations, AppGallery Connect provides a configuration file storing your app configurations. You simply need to add the configuration file to your project and integrate the AppGallery Connect plugin. The AppGallery Connect plugin will automatically load the app information configured in AppGallery Connect to your development environment.

By default, the configuration file contains the client secret and API key generated by AppGallery Connect for your app. If you have upgraded to the pay-as-you-go plan, to guard against bills generated through identity spoofing, you are advised to save your own client secret and API key on your server. Before obtaining app configurations, you can select Do not include key, so that your client secret and API key will not be included in the configuration file. In this case, you need to call the APIs of the AppGallery Connect plugin for manual configuration. If you are developing an Android app, you can refer to Setting Parameters Using the Configuration File (only for Android Apps). If you are developing an iOS app, you can refer to Through Parameters in the Configuration File.

Configure the Maven repository address and AppGallery Connect plugin address in the Android module of your React Native project.
- allprojects {
- repositories {
- google()
- jcenter()
- // Add the following line:
- maven {url 'https://developer.huawei.com/repo/'}
- }
- }
- buildscript {
- repositories {
- google()
- jcenter()
- // Add the following line:
- maven {url 'https://developer.huawei.com/repo/'}
- }
- }
- buildscript {
- dependencies {
- // Add the following line:
- classpath 'com.huawei.agconnect:agcp:1.9.6.300'
- }
- }
- apply plugin: 'com.huawei.agconnect'
- npm install @react-native-agconnect/crash@1.3.0
Service | Configuration |
|---|---|
Remote Configuration | npm install @react-native-agconnect/remoteconfig@1.3.0 |
Crash | npm install @react-native-agconnect/crash@1.3.0 |
Auth Service | npm install @react-native-agconnect/auth@1.3.0 |
App Linking | npm install @react-native-agconnect/applinking@1.3.0 |
App Messaging | npm install @react-native-agconnect/appmessaging@1.3.0 |
The preceding version numbers are only examples. If the version number is not specified, the latest version is used. If you want to install a specified version, add @x.x.x following the service name.
- react-native link @react-native-agconnect/crash
- pod install
Import the header file AGConnectCore/AGConnectCore.h to the AppDelegate.m file of the project, and add the following code to the application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions method:
Objective-C:
- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions {
- // Override point for customization after Application launch.
- [AGCInstance startUp]; // Initialization.
- return YES;
- }
Now, you can use required AppGallery Connect services in React Native.
The AppGallery Connect SDK provides the @react-native-agconnect/core plugin to configure parameters in the agconnect-services.json file. If you have selected Do not include key when downloading the configuration file, the client_id, client_secret, and api_key parameters are not included in the agconnect-services.json file. You must set the required parameters in the AppGallery Connect SDK through the @react-native-agconnect/core plugin.
- npm install @react-native-agconnect/core@1.3.0
You are advised to call the plugin in the App.js method.
- AGCApp.getInstance().setClientId('clientId');
- AGCApp.getInstance().setClientSecret('clientSecret');
- AGCApp.getInstance().setApiKey('apiKey');
Go to Project settings > General information, and query the parameter values. Replace clientId with the value of Client ID, clientSecret with the value of Client secret, and apikey with the value of API key. Click
next to each parameter to copy the value.

This section does not describe app function development in detail. You need to complete the development by yourself.