- 1. Introduction
- 2. Installation Guide
- 3. Configuration and Description
- 4. Development Environment
- 5. FAQs
- 6. Licencing and Terms
This demo application demonstrates the usage of AGC CloudDB Cordova plugin.
Before you get started, you must register as a HUAWEI Developer and complete identity verification on the HUAWEI Developer website. For details, please refer to Register a HUAWEI ID.
Creating an app in AppGallery Connect is required in order to communicate with the Huawei services. To create an app, perform the following steps:
- Sign in to AppGallery Connect and select My projects.
- Select your project from the project list or create a new one by clicking the Add Project button.
- Go to Project settings > General information, and click Add app. If an app exists in the project and you need to add a new one, expand the app selection area on the top of the page and click Add app.
- On the Add app page, enter the app information, and click OK.
Click Cloud DB on the navigation bar and enable database service. Then, perform the following operations:
-
Create a schema by importing a template file stored in CloudDBQuickStart_1.json in the root directory of the project. Alternatively, create a schema named BookInfo and ensure that all fields must be the same as those in CloudDBQuickStart_1.json.
-
Create a Cloud DB zone. On the Cloud DB Zone tab page, click Add to create a Cloud DB zone named QuickStartDemo.
-
Export Object type with Java and Objective-C file format.
-
Sign in to AppGallery Connect and select your project from My Projects. Then go to Project settings > General information. In the App information field,
- If platform is Android, click agconnect-services.json button to download the configuration file.
- If platform is iOS, click agconnect-services.plist button to download the configuration file.
-
Install Cordova CLI.
npm install -g cordova
-
Set preference in your Ionic project config.xml.
<!--<platform name="ios">--> <preference name="deployment-target" value="11.0" /> <preference name="SwiftVersion" value="5" />
-
Update the widget
id
property which is specified in theconfig.xml
file. It must be same with client > package_name value of theagconnect-services.json
andagconnect-services.plist
files. -
Add the Android or iOS platform to the project if haven't done before.
cordova platform add android
cordova platform add ios
-
Install
AGC CloudDB Cordova Plugin
to the project.-
Run the following command in the root directory of your project to install it through npm.
cordova plugin add @cordova-plugin-agconnect/clouddb
-
-
Install
AGC Auth Cordova Plugin
to the project.-
Run the following command in the root directory of your project to install it through npm.
cordova plugin add @cordova-plugin-agconnect/auth
-
-
Add
agconnect-services.plist
file to the app's root directory of your Xcode project. -
Adding Object Type Files
- During application development, you can directly add the Objective-C files exported from the AppGallery Connect console to the local development environment.
-
Check Signing & Capabilities tab page of your Xcode project.
-
Run the application.
cordova run ios --device
-
Copy
agconnect-services.json
file to<project_root>/platforms/android/app
directory your Android project. -
Copying Object Type Files
- During application development, you can directly add the Java files exported from the AppGallery Connect console to the local development environment with com.development.clouddb package name.
- Copy exported Java files to
<project_root>/platforms/android/app/src/main/java/com/development/clouddb
directory your Android project.
-
Run the application.
cordova run android --device
No.
You are advised to use the plug-ins in an environment that meets the following requirements.
Software | Allowed Version Range | Description |
---|---|---|
cordova | 9.0.0 or later | Platform |
cordova-android | >=8.1.0 or later | Platform |
cordova-ios | 5.0.0 or later | Platform |
npm | 6.4.1 or later | Tool |
Why is the message 'google/protobuf/any.h' file not found file not found displayed when I run pod install?
Protobuf-C++ causes the problem.
You can fix this problem by following the steps below.
- Delete
<project_root>/platforms/ios/Podfile.lock
file. - Delete
use_frameworks!
line in<project_root>/platforms/ios/Podfile
file. - cd
<project_root>/platforms/ios
directory and run this commandpod install
AGC Cloud DB Cordova Plugin is licensed under the Apache 2.0 license.