-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
92f40fe
commit 67247c8
Showing
59 changed files
with
1,607 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Miscellaneous | ||
*.class | ||
*.log | ||
*.pyc | ||
*.swp | ||
.DS_Store | ||
.atom/ | ||
.buildlog/ | ||
.history | ||
.svn/ | ||
|
||
# IntelliJ related | ||
*.iml | ||
*.ipr | ||
*.iws | ||
.idea/ | ||
|
||
# The .vscode folder contains launch configuration and tasks you configure in | ||
# VS Code which you may wish to be included in version control, so this line | ||
# is commented out by default. | ||
#.vscode/ | ||
|
||
# Flutter/Dart/Pub related | ||
**/doc/api/ | ||
**/ios/Flutter/.last_build_id | ||
.dart_tool/ | ||
.flutter-plugins | ||
.flutter-plugins-dependencies | ||
.packages | ||
.pub-cache/ | ||
.pub/ | ||
/build/ | ||
pubspec.lock | ||
|
||
# Web related | ||
lib/generated_plugin_registrant.dart | ||
|
||
# Symbolication related | ||
app.*.symbols | ||
|
||
# Obfuscation related | ||
app.*.map.json | ||
|
||
# Android Studio will place build artifacts here | ||
/android/app/debug | ||
/android/app/profile | ||
/android/app/release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# This file tracks properties of this Flutter project. | ||
# Used by Flutter tool to assess capabilities and perform upgrades etc. | ||
# | ||
# This file should be version controlled and should not be manually edited. | ||
|
||
version: | ||
revision: f139b11009aeb8ed2a3a3aa8b0066e482709dde3 | ||
channel: stable | ||
|
||
project_type: app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# AppGallery Connect APM Flutter Demo | ||
|
||
## Contents | ||
|
||
- [1. Introduction](#1-introduction) | ||
- [2. Installation Guide](#2-installation-guide) | ||
- [2.1. Creating a Project in AppGallery Connect](#21-creating-a-project-in-appgallery-connect) | ||
- [2.2. Obtaining agconnect-services.json and agconnect-services.plist](#22-obtaining-agconnect-servicesjson-and-agconnect-servicesplist) | ||
- [2.3. Build & Run the project](#23-build-&-run-the-project) | ||
- [3. Configuration and Description](#3-configuration-and-description) | ||
- [4. Licencing and Terms](#4-licencing-and-terms) | ||
|
||
--- | ||
|
||
## 1. Introduction | ||
|
||
This demo application demonstrates the usage of AppGallery Connect APM Flutter plugin. | ||
|
||
--- | ||
|
||
## 2. Installation Guide | ||
|
||
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/?ha_source=hms1) website. For details, please refer to [Register a HUAWEI ID](https://developer.huawei.com/consumer/en/doc/10104?ha_source=hms1). | ||
|
||
### 2.1. Creating a Project in AppGallery Connect | ||
|
||
Creating an app in AppGallery Connect is required in order to communicate with the Huawei services. To create an app, perform the following steps: | ||
|
||
1. Sign in to [AppGallery Connect](https://developer.huawei.com/consumer/en/service/josp/agc/index.html?ha_source=hms1) and select **My projects**. | ||
2. Select your project from the project list or create a new one by clicking the **Add Project** button. | ||
3. 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**. | ||
4. On the **Add app** page, enter the app information, and click **OK**. | ||
|
||
### 2.2. Obtaining agconnect-services.json and agconnect-services.plist | ||
|
||
1. Sign in to [AppGallery Connect](https://developer.huawei.com/consumer/en/service/josp/agc/index.html?ha_source=hms1) 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. | ||
|
||
### 2.3 Build & Run the project | ||
|
||
**Step 1:** Run the following command to update package info. | ||
|
||
``` | ||
[project_path]> flutter pub get | ||
``` | ||
|
||
**Step 2:** Run the following command to start the demo app. | ||
|
||
``` | ||
[project_path]> flutter run | ||
``` | ||
|
||
--- | ||
|
||
## 3. Configuration and Description | ||
|
||
No. | ||
|
||
--- | ||
|
||
## 4. Licencing and Terms | ||
|
||
AppGallery Connect APM Flutter plugin is licensed under the [Apache 2.0 license](LICENCE). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
gradle-wrapper.jar | ||
/.gradle | ||
/captures/ | ||
/gradlew | ||
/gradlew.bat | ||
/local.properties | ||
GeneratedPluginRegistrant.java | ||
|
||
# Remember to never publicly share your keystore. | ||
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app | ||
key.properties | ||
|
||
*.jks | ||
*.keystore | ||
|
||
/app/agconnect-services.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
def localProperties = new Properties() | ||
def localPropertiesFile = rootProject.file('local.properties') | ||
if (localPropertiesFile.exists()) { | ||
localPropertiesFile.withReader('UTF-8') { reader -> | ||
localProperties.load(reader) | ||
} | ||
} | ||
|
||
def flutterRoot = localProperties.getProperty('flutter.sdk') | ||
if (flutterRoot == null) { | ||
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") | ||
} | ||
|
||
def flutterVersionCode = localProperties.getProperty('flutter.versionCode') | ||
if (flutterVersionCode == null) { | ||
flutterVersionCode = '1' | ||
} | ||
|
||
def flutterVersionName = localProperties.getProperty('flutter.versionName') | ||
if (flutterVersionName == null) { | ||
flutterVersionName = '1.0' | ||
} | ||
|
||
apply plugin: 'com.android.application' | ||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" | ||
apply plugin: 'com.huawei.agconnect' | ||
|
||
android { | ||
compileSdkVersion 29 | ||
defaultConfig { | ||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). | ||
applicationId "<package_name>" | ||
minSdkVersion 19 | ||
targetSdkVersion 29 | ||
versionCode flutterVersionCode.toInteger() | ||
versionName flutterVersionName | ||
} | ||
lintOptions { | ||
disable 'InvalidPackage' | ||
} | ||
signingConfigs { | ||
config { | ||
storeFile file("<keystore_file>.jks/.keystore") | ||
storePassword "<keystore_password>" | ||
keyAlias "<key_alias>" | ||
keyPassword "<key_password>" | ||
v1SigningEnabled true | ||
v2SigningEnabled true | ||
} | ||
} | ||
buildTypes { | ||
debug { | ||
// signingConfig signingConfigs.config | ||
} | ||
release { | ||
minifyEnabled true | ||
shrinkResources true | ||
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" | ||
signingConfig signingConfigs.config | ||
} | ||
} | ||
} | ||
|
||
flutter { | ||
source '../..' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
-ignorewarnings | ||
-keepattributes *Annotation* | ||
-keepattributes Exceptions | ||
-keepattributes InnerClasses | ||
-keepattributes Signature | ||
-keep class com.hianalytics.android.**{*;} | ||
-keep class com.huawei.updatesdk.**{*;} | ||
-keep class com.huawei.hianalytics.**{*;} | ||
-keep class com.huawei.hms.**{*;} | ||
-keep class com.huawei.agc.**{*;} | ||
-keep class com.huawei.agconnect.**{*;} | ||
|
||
## Flutter wrapper | ||
-keep class io.flutter.app.** { *; } | ||
-keep class io.flutter.plugin.** { *; } | ||
-keep class io.flutter.util.** { *; } | ||
-keep class io.flutter.view.** { *; } | ||
-keep class io.flutter.** { *; } | ||
-keep class io.flutter.plugins.** { *; } | ||
-dontwarn io.flutter.embedding.** | ||
-keep class com.huawei.agconnectapm.** { *; } | ||
-repackageclasses |
43 changes: 43 additions & 0 deletions
43
Flutter/agc-apm-flutter/android/app/src/main/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.huawei.agconnect_apm_example"> | ||
|
||
<uses-permission android:name="android.permission.INTERNET" /> | ||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
|
||
<application | ||
android:name="io.flutter.app.FlutterApplication" | ||
android:allowBackup="false" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="agconnect_apm_example"> | ||
<activity | ||
android:name=".MainActivity" | ||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" | ||
android:hardwareAccelerated="true" | ||
android:launchMode="singleTop" | ||
android:theme="@style/LaunchTheme" | ||
android:windowSoftInputMode="adjustResize"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
<!-- Set this flag to 'true', debug logs of APM will be printed in logcat. --> | ||
<meta-data | ||
android:name="apms_debug_log_enabled" | ||
android:value="true" /> | ||
<meta-data | ||
android:name="sessions_sampling_percentage" | ||
android:value="100" /> | ||
<!-- Set this value to '100', means the cpu sampling frequency is 100 ms. --> | ||
<meta-data | ||
android:name="collect_cpu_frequency_fg_ms" | ||
android:value="100" /> | ||
<!-- Set this value to '100', means the memory sampling frequency is 100 ms. --> | ||
<meta-data | ||
android:name="collect_memory_frequency_fg_ms" | ||
android:value="100" /> | ||
<meta-data | ||
android:name="flutterEmbedding" | ||
android:value="2" /> | ||
</application> | ||
</manifest> |
19 changes: 19 additions & 0 deletions
19
...-apm-flutter/android/app/src/main/java/com/huawei/agconnect_apm_example/MainActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved. | ||
*/ | ||
|
||
package com.huawei.agconnect_apm_example; | ||
|
||
import androidx.annotation.NonNull; | ||
|
||
import com.huawei.agconnectapm.AGConnectAPMActivity; | ||
|
||
import io.flutter.embedding.engine.FlutterEngine; | ||
import io.flutter.plugins.GeneratedPluginRegistrant; | ||
|
||
public class MainActivity extends AGConnectAPMActivity { | ||
@Override | ||
public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) { | ||
GeneratedPluginRegistrant.registerWith(flutterEngine); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
Flutter/agc-apm-flutter/android/app/src/main/res/drawable/launch_background.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- Modify this file to customize your launch splash screen --> | ||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<item android:drawable="@android:color/white" /> | ||
|
||
<!-- You can insert your own image assets here --> | ||
<!-- <item> | ||
<bitmap | ||
android:gravity="center" | ||
android:src="@mipmap/launch_image" /> | ||
</item> --> | ||
</layer-list> |
Binary file added
BIN
+544 Bytes
Flutter/agc-apm-flutter/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+442 Bytes
Flutter/agc-apm-flutter/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+721 Bytes
Flutter/agc-apm-flutter/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.01 KB
Flutter/agc-apm-flutter/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.41 KB
Flutter/agc-apm-flutter/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions
8
Flutter/agc-apm-flutter/android/app/src/main/res/values/styles.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar"> | ||
<!-- Show a splash screen on the activity. Automatically removed when | ||
Flutter draws its first frame --> | ||
<item name="android:windowBackground">@drawable/launch_background</item> | ||
</style> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
buildscript { | ||
repositories { | ||
google() | ||
jcenter() | ||
maven { url 'https://developer.huawei.com/repo/' } | ||
} | ||
dependencies { | ||
classpath 'com.android.tools.build:gradle:3.6.0' | ||
classpath 'com.huawei.agconnect:agcp:1.5.0.300' | ||
} | ||
} | ||
|
||
allprojects { | ||
repositories { | ||
google() | ||
jcenter() | ||
maven { url 'https://developer.huawei.com/repo/' } | ||
} | ||
} | ||
|
||
rootProject.buildDir = '../build' | ||
subprojects { | ||
project.buildDir = "${rootProject.buildDir}/${project.name}" | ||
} | ||
subprojects { | ||
project.evaluationDependsOn(':app') | ||
} | ||
|
||
task clean(type: Delete) { | ||
delete rootProject.buildDir | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
org.gradle.jvmargs=-Xmx1536M | ||
android.enableR8=true | ||
android.useAndroidX=true | ||
android.enableJetifier=true |
6 changes: 6 additions & 0 deletions
6
Flutter/agc-apm-flutter/android/gradle/wrapper/gradle-wrapper.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#Fri Jun 23 08:50:38 CEST 2017 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
include ':app' | ||
|
||
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() | ||
|
||
def plugins = new Properties() | ||
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') | ||
if (pluginsFile.exists()) { | ||
pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } | ||
} | ||
|
||
plugins.each { name, path -> | ||
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() | ||
include ":$name" | ||
project(":$name").projectDir = pluginDirectory | ||
} |
Oops, something went wrong.