Skip to content

Commit b9283fd

Browse files
author
mayism
committed
crash/update
1 parent 099c860 commit b9283fd

File tree

8 files changed

+356
-62
lines changed

8 files changed

+356
-62
lines changed

crash/README.md

Lines changed: 130 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,139 @@
1-
# AGConnect Cordova Crash Demo
1+
# AGC Crash Cordova Demo
22

3-
`In the root directory, perform the following operations:`
3+
## Contents
44

5-
`Step 1: Run the following command to install the NPM dependency`
6-
`$ npm install`
5+
- [1. Introduction](#1-introduction)
6+
- [2. Installation Guide](#2-installation-guide)
7+
- [2.1. Creating a Project in AppGallery Connect](#21-creating-a-project-in-appgallery-connect)
8+
- [2.2. Obtaining agconnect-services.json and agconnect-services.plist](#22-obtaining-agconnect-servicesjson-and-agconnect-servicesplist)
9+
- [2.3. Enabling Crash Service](#24-enabling-crash-service)
10+
- [2.4. Cordova](#26-cordova)
11+
- [2.4.1. iOS App Development](#261-ios-app-development)
12+
- [2.4.2. Android App Development](#262-android-app-development)
13+
- [3. Method Definitions](#3-method-definitions)
14+
- [4. Configuration and Description](#4-configuration-and-description)
15+
- [5. Licensing and Terms](#5-licensing-and-terms)
716

8-
`Step 2: Run the following command to create the corresponding platform code`
9-
`$ cordova platform add ios/android`
17+
---
1018

11-
`Step 3: Run the following command to download and install the AGC crashplugin`
12-
`$ cordova plugin add @cordova-plugin-agconnect/crash --save`
19+
## 1. Introduction
1320

14-
`Step 4: Put the corresponding agconnect-services.json/agconnect-services.plist into the appropriate directory`
21+
This demo application demonstrates the usage of AGC Crash Cordova plugin.
1522

16-
`Step 5: Change the package name in the config.xml file to the package name in the agconnect-services.json/agconnect-services.plist file`
23+
---
1724

18-
`Step 6: Add the agcp-plto the corresponding bulid.gradle(only Android)`
25+
## 2. Installation Guide
1926

20-
`apply plugin: 'com.huawei.agconnect'`
27+
Before you get started, you must register as a HUAWEI Developer and complete identity verification on the [HUAWEI Developer](https://developer.huawei.com/consumer/en/) website. For details, please refer to [Register a HUAWEI ID](https://developer.huawei.com/consumer/en/doc/10104).
2128

29+
### 2.1. Creating a Project in AppGallery Connect
30+
31+
Creating an app in AppGallery Connect is required in order to communicate with the Huawei services. To create an app, perform the following steps:
32+
33+
1. Sign in to [AppGallery Connect](https://developer.huawei.com/consumer/en/service/josp/agc/index.html) and select **My projects**.
34+
2. Select your project from the project list or create a new one by clicking the **Add Project** button.
35+
3. Go to **Project settings** > **General information**, and click **Add app**.
36+
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**.
37+
4. On the **Add app** page, enter the app information, and click **OK**.
38+
39+
### 2.2. Obtaining agconnect-services.json and agconnect-services.plist
40+
41+
1. Sign in to [AppGallery Connect](https://developer.huawei.com/consumer/en/service/josp/agc/index.html) and select your project from **My Projects**. Then go to **Project settings** > **General information**. In the **App information** field,
42+
43+
- If platform is Android, click **agconnect-services.json** button to download the configuration file.
44+
- If platform is iOS, click **agconnect-services.plist** button to download the configuration file.
45+
46+
### 2.3. Enabling Crash Service
47+
48+
1. In [AppGallery Connect](https://developer.huawei.com/consumer/en/service/josp/agc/index.html), find your project, and click the app for which you want to use crash.
49+
50+
2. Select **Quality** and **Crash** on the left menu and click **Enable now**.
51+
52+
### 2.4. Cordova
53+
54+
1. Install Cordova CLI.
55+
56+
```bash
57+
npm install -g cordova
58+
```
59+
60+
2. Create a new Cordova project or use existing Cordova project.
61+
62+
- To create new Cordova project, you can use **`cordova create path [id [name [config]]] [options]`** command. For more details please follow [CLI Reference - Apache Cordova](https://cordova.apache.org/docs/en/latest/reference/cordova-cli/index.html#cordova-create-command).
63+
64+
3. Update the widget **`id`** property which is specified in the **`config.xml`** file. It must be same with **client > package_name** value of the **`agconnect-services.json`** and **`agconnect-services.plist`** files.
65+
66+
4. Update the '<set_triggerIdentifier>' parameter which is specified in the **`<project_root>/www/js/index.js`** file.
67+
68+
5. Check preference in your Cordova project config.xml.
69+
70+
```xml
71+
<!--platform iOS-->
72+
<preference name="deployment-target" value="11.0" />
73+
<preference name="SwiftVersion" value="5" />
74+
```
75+
76+
6. Add the **Android** or **iOS** platform to the project if haven't done before.
77+
78+
```bash
79+
cordova platform add android
80+
```
81+
82+
```bash
83+
cordova platform add ios
84+
```
85+
86+
7. Install `AGC Crash Cordova Plugin` to the project.
87+
88+
- Run the following command in the root directory of your project to install it through **npm**.
89+
90+
```bash
91+
cordova plugin add @cordova-plugin-agconnect/crash
92+
```
93+
94+
#### 2.4.1. iOS App Development
95+
96+
1. Add **`agconnect-services.plist`** file to the app's root directory of your Xcode project.
97+
98+
2. Run the application.
99+
100+
```bash
101+
cordova run ios --device
102+
```
103+
104+
#### 2.4.2. Android App Development
105+
106+
1. Copy **`agconnect-services.json`** file to **`<project_root>/platforms/android/app`** directory your Android project.
107+
108+
2. Run the application.
109+
110+
```bash
111+
cordova run android --device
112+
```
113+
114+
---
115+
116+
## 3. Method Definitions
117+
118+
#### Public Method Summary
119+
120+
| Method | Return Type | Description |
121+
| ----------------- | ----------- | -------------------------------- |
122+
| testIt() | `void` | Create a crash to test. |
123+
| setUserId() | `void` | Set the user ID. |
124+
| setCustomKey() | `void` | Set Custom Status. |
125+
| logWithLevel() | `void` | Recording Custom Logs with level |
126+
| log() | `void` | Recording Custom Logs |
127+
| recordException() | `void` | Recording Non-Fatal Exceptions |
128+
129+
---
130+
131+
## 4. Configuration and Description
132+
133+
No.
134+
135+
---
136+
137+
## 6. Licensing and Terms
138+
139+
AGC Crash Cordova Plugin is licensed under the [Apache 2.0 license](LICENCE).

crash/www/css/index.css

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
/*
2-
* Licensed to the Apache Software Foundation (ASF) under one
3-
* or more contributor license agreements. See the NOTICE file
4-
* distributed with this work for additional information
5-
* regarding copyright ownership. The ASF licenses this file
6-
* to you under the Apache License, Version 2.0 (the
7-
* "License"); you may not use this file except in compliance
8-
* with the License. You may obtain a copy of the License at
9-
*
10-
* http://www.apache.org/licenses/LICENSE-2.0
11-
*
12-
* Unless required by applicable law or agreed to in writing,
13-
* software distributed under the License is distributed on an
14-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15-
* KIND, either express or implied. See the License for the
16-
* specific language governing permissions and limitations
17-
* under the License.
18-
*/
2+
Copyright 2020. Huawei Technologies Co., Ltd. All rights reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License")
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
https://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
1917
* {
2018
-webkit-tap-highlight-color: rgba(0,0,0,0); /* make transparent link selection, adjust last value opacity 0 to 1.0 */
2119
}

crash/www/index.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
<!--
2+
Copyright 2020. Huawei Technologies Co., Ltd. All rights reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License")
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
https://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
--->
116
<html>
217
<head>
318
<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *; img-src 'self' data: content:;">

crash/www/js/index.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
Copyright 2020. Huawei Technologies Co., Ltd. All rights reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License")
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
https://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
117
var btnTest = document.getElementById("testCrash");
218
var btnEn = document.getElementById("crashCollectEnable");
319
var btnDis = document.getElementById("crashCollectDisable");
@@ -34,12 +50,10 @@ function testCrash() {
3450
AGCCrashPlugin.testIt();
3551

3652
function success() {
37-
//调用成功的处理
38-
//console.log('success');
53+
console.log('success');
3954
}
4055

4156
function error() {
42-
//调用失败的处理
43-
//console.log('error');
57+
console.log('error');
4458
}
4559
}

remoteconfig/README.md

Lines changed: 132 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,141 @@
1-
# AGConnect Cordova Remoteconfig Demo
1+
# AGC RemoteConfig Cordova Demo
22

3-
`In the root directory, perform the following operations:`
3+
## Contents
44

5-
`Step 1: Run the following command to install the NPM dependency`
6-
`$ npm install`
5+
- [1. Introduction](#1-introduction)
6+
- [2. Installation Guide](#2-installation-guide)
7+
- [2.1. Creating a Project in AppGallery Connect](#21-creating-a-project-in-appgallery-connect)
8+
- [2.2. Obtaining agconnect-services.json and agconnect-services.plist](#22-obtaining-agconnect-servicesjson-and-agconnect-servicesplist)
9+
- [2.3. Enabling RemoteConfig Service](#24-enabling-RemoteConfig-service)
10+
- [2.4. Cordova](#26-cordova)
11+
- [2.4.1. iOS App Development](#261-ios-app-development)
12+
- [2.4.2. Android App Development](#262-android-app-development)
13+
- [3. Method Definitions](#3-method-definitions)
14+
- [4. Configuration and Description](#4-configuration-and-description)
15+
- [5. Licensing and Terms](#5-licensing-and-terms)
716

8-
`Step 2: Run the following command to create the corresponding platform code`
9-
`$ cordova platform add ios/android`
17+
---
1018

11-
`Step 3: Run the following command to download and install the AGC remoteconfig plugin`
12-
`$ cordova plugin add @cordova-plugin-agconnect/remoteconfig --save`
19+
## 1. Introduction
1320

14-
`Step 4: Put the corresponding agconnect-services.json/agconnect-services.plist into the appropriate directory`
21+
This demo application demonstrates the usage of AGC Cloud Functions Cordova plugin.
1522

16-
`Step 5: Change the package name in the config.xml file to the package name in the agconnect-services.json/agconnect-services.plist file`
23+
---
1724

18-
`Step 6: Add the agcp-plto the corresponding bulid.gradle(only Android)`
25+
## 2. Installation Guide
1926

20-
`apply plugin: 'com.huawei.agconnect'`
27+
Before you get started, you must register as a HUAWEI Developer and complete identity verification on the [HUAWEI Developer](https://developer.huawei.com/consumer/en/) website. For details, please refer to [Register a HUAWEI ID](https://developer.huawei.com/consumer/en/doc/10104).
2128

29+
### 2.1. Creating a Project in AppGallery Connect
30+
31+
Creating an app in AppGallery Connect is required in order to communicate with the Huawei services. To create an app, perform the following steps:
32+
33+
1. Sign in to [AppGallery Connect](https://developer.huawei.com/consumer/en/service/josp/agc/index.html) and select **My projects**.
34+
2. Select your project from the project list or create a new one by clicking the **Add Project** button.
35+
3. Go to **Project settings** > **General information**, and click **Add app**.
36+
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**.
37+
4. On the **Add app** page, enter the app information, and click **OK**.
38+
39+
### 2.2. Obtaining agconnect-services.json and agconnect-services.plist
40+
41+
1. Sign in to [AppGallery Connect](https://developer.huawei.com/consumer/en/service/josp/agc/index.html) and select your project from **My Projects**. Then go to **Project settings** > **General information**. In the **App information** field,
42+
43+
- If platform is Android, click **agconnect-services.json** button to download the configuration file.
44+
- If platform is iOS, click **agconnect-services.plist** button to download the configuration file.
45+
46+
### 2.3. Enabling RemoteConfig Service
47+
48+
1. In [AppGallery Connect](https://developer.huawei.com/consumer/en/service/josp/agc/index.html), find your project, and click the app for which you want to use cloud functions.
49+
50+
2. Select **Grow** and **Remote Config** on the left menu and click **Enable now**.
51+
52+
### 2.4. Cordova
53+
54+
1. Install Cordova CLI.
55+
56+
```bash
57+
npm install -g cordova
58+
```
59+
60+
2. Create a new Cordova project or use existing Cordova project.
61+
62+
- To create new Cordova project, you can use **`cordova create path [id [name [config]]] [options]`** command. For more details please follow [CLI Reference - Apache Cordova](https://cordova.apache.org/docs/en/latest/reference/cordova-cli/index.html#cordova-create-command).
63+
64+
3. Update the widget **`id`** property which is specified in the **`config.xml`** file. It must be same with **client > package_name** value of the **`agconnect-services.json`** and **`agconnect-services.plist`** files.
65+
66+
4. Update the '<set_triggerIdentifier>' parameter which is specified in the **`<project_root>/www/js/index.js`** file.
67+
68+
5. Check preference in your Cordova project config.xml.
69+
70+
```xml
71+
<!--platform iOS-->
72+
<preference name="deployment-target" value="11.0" />
73+
<preference name="SwiftVersion" value="5" />
74+
```
75+
76+
6. Add the **Android** or **iOS** platform to the project if haven't done before.
77+
78+
```bash
79+
cordova platform add android
80+
```
81+
82+
```bash
83+
cordova platform add ios
84+
```
85+
86+
7. Install `AGC RemoteConfig Cordova Plugin` to the project.
87+
88+
- Run the following command in the root directory of your project to install it through **npm**.
89+
90+
```bash
91+
cordova plugin add @cordova-plugin-agconnect/remoteconfig
92+
```
93+
94+
#### 2.6.1. iOS App Development
95+
96+
1. Add **`agconnect-services.plist`** file to the app's root directory of your Xcode project.
97+
98+
2. Run the application.
99+
100+
```bash
101+
cordova run ios --device
102+
```
103+
104+
#### 2.6.2. Android App Development
105+
106+
1. Copy **`agconnect-services.json`** file to **`<project_root>/platforms/android/app`** directory your Android project.
107+
108+
2. Run the application.
109+
110+
```bash
111+
cordova run android --device
112+
```
113+
114+
---
115+
116+
## 3. Method Definitions
117+
118+
#### Public Method Summary
119+
120+
| Method | Return Type | Description |
121+
| ---------------- | ----------- | ------------------------------------------------------------ |
122+
| applyDefault | void | Setting Local Default Parameters |
123+
| applyLastFetched | void | Make the latest configuration obtained from the cloud take effect. |
124+
| fetch | void | Obtain the latest configuration data from the cloud. |
125+
| getValue | void | Returns the value of the string type corresponding to the key |
126+
| getSource | void | Returns the data source corresponding to the key |
127+
| getMergedAll | void | Returns all values after the default value and cloud value are combined |
128+
| clearAll | void | Clears all cached data, including the data pulled from the cloud and the transferred default values |
129+
| setDeveloperMode | void | Set the developer mode.(This API is applicable only to the Android platform) |
130+
131+
---
132+
133+
## 4. Configuration and Description
134+
135+
No.
136+
137+
---
138+
139+
## 6. Licensing and Terms
140+
141+
AGC Cloud Functions Cordova Plugin is licensed under the [Apache 2.0 license](LICENCE).

0 commit comments

Comments
 (0)