You can create an app in AppGallery Connect. Then AppGallery Connect will automatically generate basic configuration information for it.

  1. Sign in to AppGallery Connect.
  2. Click My projects.
  3. Click Add project. In the dialog box that is displayed, enter a project name, and click OK.
  4. Go to Project settings > General information. On the page displayed, click Add app.
  5. On the Add app page, set the app name, package name, platform, device, app category (app or game), and language for your app as needed.
  6. Check the app package name and other information in your project under My projects.
  1. Install the React Native dependency.
    npm install -g yarn

    The following figure shows the result after installation.

  2. Create a React Native project.

    npx react-nat***<project name>***ect name>

    For example, you can create a project named rndemo by running the following command:

    npx react-native init rndemo

    If the creation is successful, the following information is displayed.

  1. Open the build.gradle file in the android folder of the React Native project and add the Maven repository and AppGallery Connect plugin.
    buildscript { repositories { google() jcenter() // Make sure that the following line is added. maven { url 'https://developer.huawei.com/repo/' } // HUAWEI Maven repository } dependencies { classpath 'com.android.tools.build:gradle:3.5.3' // Add the following line. classpath 'com.huawei.agconnect:agcp:1.5.0.300' // HUAWEI agcp plugin } } allprojects { repositories { google() jcenter() // Make sure that the following line is added. maven { url 'https://developer.huawei.com/repo/' } // HUAWEI Maven repository } }
  2. Open the build.gradle file under android/app and add build dependencies.
    Add the following information under apply plugin: ‘com.android.application':
    apply plugin: 'com.android.application' // Make sure that the following line is added. apply plugin: 'com.huawei.agconnect
  3. Initialize the AppGallery Connect SDK for iOS.
    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:
    - (BOOL)Application:(UIApplication *)Application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions { // Override the code for customization after app launch. [AGCInstance startup]; return YES; }
Code copied