GithubHelp home page GithubHelp logo

appgalleryconnect / agc-android-demos Goto Github PK

View Code? Open in Web Editor NEW
13.0 2.0 2.0 10.28 MB

This repository including all of exsiting demos of AppGallery Connect Service in Android.

License: Apache License 2.0

Java 54.01% Kotlin 42.59% Batchfile 0.02% CMake 2.13% C++ 0.79% JavaScript 0.13% C 0.33%
crash cloudstorage appmessaging authservice applinking remoteconfig apm authentication bugly serverless

agc-android-demos's Introduction

agc-android-demos

license

This repository contains the source code for AppGallery Connect Android demos, which are developed by the AppGallery Connect team.

These demos enable access to using specific APIs. For more demos and how to use them, please refer to the AppGallery Connect documentation.

Introduction

These are the available plugins in this repository.

Demo Version Documentation
apms version Getting Started
API Reference
applinking version Getting Started
API Reference
appmessaging version Getting Started
API Reference
authservice version Getting Started
API Reference
clouddb-java version Getting Started
API Reference
clouddb-kotlin version Getting Started
API Reference
cloudfunction version Getting Started
API Reference
cloudstorage version Getting Started
API Reference
crash version Getting Started
API Reference
dynamicability version Getting Started
API Reference
remoteconfig version Getting Started
API Reference

Precautions

The agc-android-demos project contains 11 independent projects. After downloading the code, you can load different nested projects to the IDE as required. And you can run each project independently.

Technical Support

If you have any questions about the sample code, try the following:

  • Visit Stack Overflow, submit your questions, and tag them with appgallery or appgallery connect.
  • Go to AppGallery in the HUAWEI Developer Forum and communicate with other developers.
  • Submit a ticket online to contact Huawei technical support if you encounter a serious or an urgent problem.

If you encounter any issues when using the sample code, submit your issues or submit a pull request.

agc-android-demos's People

Contributors

huan721 avatar mayism avatar mindixia avatar yycccc91 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

agc-android-demos's Issues

obsolete transform api with Gradle sync

I am currently on Gradle 7.3.1.

This becomes an issue in Gradle 8.0
When I apply the plugin: apply plugin: 'com.huawei.agconnect'

API 'android.registerTransform' is obsolete.
It will be removed in version 8.0 of the Android Gradle plugin.
The Transform API is removed to improve build performance. Projects that use the
Transform API force the Android Gradle plugin to use a less optimized flow for the
build that can result in large regressions in build times. It’s also difficult to
use the Transform API and combine it with other Gradle features; the replacement
APIs aim to make it easier to extend the build without introducing performance or
correctness issues.

There is no single replacement for the Transform API—there are new, targeted
APIs for each use case. All the replacement APIs are in the
androidComponents {} block.

The Transform API uses incremental APIs deprecated since Gradle 7.5. Please add
android.experimental.legacyTransform.forceNonIncremental=true to
gradle.properties to fix this issue. Note that this will run transforms
non-incrementally and may have a build performance impact.
For more information, see https://developer.android.com/studio/releases/gradle-plugin-api-updates#transform-api.
To determine what is calling android.registerTransform, use -Pandroid.debug.obsoleteApi=true on the command line to display more information.
Affected Modules: app

云数据库 Cloud DB 几个问题

看完Cloud DB文档:
https://developer.huawei.com/consumer/cn/doc/development/AppGallery-connect-Guides/agc-clouddb-get-started-0000001127676473

有几个问题,帮忙答复下, 不然感觉无法咋真实的环境下使用

  1. 表如何 创建 id自增 主键?
  2. 关联表查询 如何实现。都要分为多次查询吗? 比如 你的例子中, 图书表book 和 用户表user 怎么查出 user_id =1 的用户的所有图书内容,同时包含 用户name 等
  3. 日期字段怎么定义

Demo触发ANR在后台没有结果

我替换了appid,更新了json之后;后台的CPU、网络数据都有展示;
当我使用demo里的触发anr的按钮,系统也弹出了anr弹框,但是后台没有数据

APM首次安装且首次打开App,会收集信息影响App隐私合规吗?

gradle配置

agcp {
    enableAPMS false
}

Application.onCreate方法

APMS.getInstance().enableCollection(false)
APMS.getInstance().enableAnrMonitor(false)

当我在首次安装app且首次打开app,在用户同意隐私协议之前,日志信息里有ANR监听和开始收集的log;
这是否已经在收集用户信息了,是否会对App合规造成影响?

2022-05-13 17:32:33.254 22344-22344/com.xxx.xxx D/com.huawei.agc.apms: using app packageId com.xxx.xxx
2022-05-13 17:32:33.255 22344-22344/com.xxx.xxx D/com.huawei.agc.apms: using application version xxx
2022-05-13 17:32:33.255 22344-22344/com.xxx.xxx D/com.huawei.agc.apms: using application versionCode xxx
2022-05-13 17:32:33.255 22344-22344/com.xxx.xxx D/com.huawei.agc.apms: using application name xxx
2022-05-13 17:32:33.260 22344-22344/com.xxx.xxx I/com.huawei.agc.apms: begin to register native anr methods.
2022-05-13 17:32:33.260 22344-22344/com.xxx.xxx I/com.huawei.agc.apms: create an anr event notifier: 77.
2022-05-13 17:32:33.260 22344-22344/com.xxx.xxx I/com.huawei.agc.apms: register own signal(sigquit) handler: 0
2022-05-13 17:32:33.260 22344-25051/com.xxx.xxx I/com.huawei.agc.apms: waiting for anr happen, block here...
2022-05-13 17:32:33.264 22344-22344/com.xxx.xxx D/com.huawei.agc.apms: Creating a new Non sampled Session: e0a4f4411078445e82c776031ba65969
2022-05-13 17:32:33.264 22344-22344/com.xxx.xxx D/com.huawei.agc.apms: Creating a new Non sampled Session: 17b1bc1c03e44b29b0e8c3c33e2ebb75
2022-05-13 17:32:33.266 22344-22344/com.xxx.xxx I/com.huawei.agc.apms: APMS v1.5.2.310
2022-05-13 17:32:33.266 22344-22344/com.xxx.xxx D/com.huawei.agc.apms: collector will start when app in foreground.
2022-05-13 17:32:33.939 22344-25109/com.xxx.xxx D/com.huawei.agc.apms: APMS: application foregrounded.
2022-05-13 17:32:33.939 22344-25109/com.xxx.xxx I/com.huawei.agc.apms: APMS v1.5.2.310
2022-05-13 17:32:33.939 22344-25109/com.xxx.xxx D/com.huawei.agc.apms: starting collector with period 60000ms.
2022-05-13 17:32:33.939 22344-25109/com.xxx.xxx D/com.huawei.agc.apms: foregroundStartTime: 1652434353939
2022-05-13 17:32:33.939 22344-25110/com.xxx.xxx D/com.huawei.agc.apms: tick took 0ms.
2022-05-13 17:32:34.024 22344-22344/com.xxx.xxx I/com.huawei.agc.apms: APMS: disable collection by user.
2022-05-13 17:32:34.025 22344-22344/com.xxx.xxx D/com.huawei.agc.apms: collector stopped.
2022-05-13 17:32:34.242 22344-25055/com.xxx.xxx I/HiAnalyticsSDK: InitTask=> Instance config init success. tag: APMS

APM在未同意隐私协议之前,获取了一次AndroidID

配置APM后,使用Hook工具,发现在用户同意隐私协议之前,APM内部调用了小米推送SDK的代码,获取了一次AndroidID,属于不合规,怎么处理?

Gradle配置

项目的Gradle

    dependencies{
        implementation 'com.huawei.agconnect:agconnect-core:1.6.5.300'
        implementation ('com.huawei.agconnect:agconnect-apms:1.5.2.310')     {
            exclude group: 'com.android.installreferrer'
        }
    }
    
    buildscript {
        dependencies {
            classpath 'com.huawei.agconnect:agcp:1.6.5.300'
        }
    }

App的Gradle

apply plugin: 'com.huawei.agconnect'

agcp { // 华为agcp
    enableAPMS false
}

代码默认设置为不收集

class CoreApplication : MultiDexApplication() {
    init {
        APMS.getInstance().enableCollection(false)
        APMS.getInstance().enableAnrMonitor(false)
    }
}

App日志:

2022-06-01 09:44:09.037 I/com.huawei.agc.apms: begin to register native anr methods.
2022-06-01 09:44:09.037 I/com.huawei.agc.apms: create an anr event notifier: 66.
2022-06-01 09:44:09.037 I/com.huawei.agc.apms: register own signal(sigquit) handler: 0
2022-06-01 09:44:09.039 I/com.huawei.agc.apms: waiting for anr happen, block here...
2022-06-01 09:44:09.051 D/com.huawei.agc.apms: Creating a new Non sampled Session: 3f256de11e1b4b2ba6dcaba58a2b409c
2022-06-01 09:44:09.051 D/com.huawei.agc.apms: Creating a new Non sampled Session: 2446aa840cf74b44b5ae167d1a4403cc
2022-06-01 09:44:09.052 I/com.huawei.agc.apms: APMS v1.5.2.310
2022-06-01 09:44:09.052 D/com.huawei.agc.apms: collector will start when app in foreground.
2022-06-01 09:44:10.690 D/com.huawei.agc.apms: APMS: application foregrounded.
2022-06-01 09:44:10.690 I/com.huawei.agc.apms: APMS v1.5.2.310
2022-06-01 09:44:10.690 D/com.huawei.agc.apms: starting collector with period 60000ms.
2022-06-01 09:44:10.690 D/com.huawei.agc.apms: foregroundStartTime: 1654047850690
2022-06-01 09:44:10.691 D/com.huawei.agc.apms: tick took 0ms.
2022-06-01 09:44:10.793 I/com.huawei.agc.apms: APMS: disable collection by user.
2022-06-01 09:44:10.793 D/com.huawei.agc.apms: collector stopped.
2022-06-01 09:44:11.003 I/HiAnalyticsSDK: InitTask=> Instance config init success. tag: APMS

Hook工具日志

2022-06-01 09:44:07.833 10371-10371/? I/VClientImpl: Xposed is enabled.
2022-06-01 09:44:14.273 10371-10484/? I/Xposed: 调用Settings.Secure.getstring获取了android_id
2022-06-01 09:44:14.274 10371-10484/? I/Xposed: dalvik.system.VMStack.getThreadStackTrace(Native Method)
    de.robv.android.xposed.DexposedBridge.handleHookedArtMethod(DexposedBridge.java:265)
    me.weishu.epic.art.entry.Entry.onHookObject(Entry.java:69)
    me.weishu.epic.art.entry.Entry.referenceBridge(Entry.java:186)
    com.xiaomi.push.j.c(Unknown Source:27)
    com.xiaomi.push.j.j(Unknown Source:3)
    com.xiaomi.mipush.sdk.b$a.a(Unknown Source:31)
    com.xiaomi.mipush.sdk.b$a.a(Unknown Source:4)
    com.xiaomi.mipush.sdk.b.c(Unknown Source:2)
    com.xiaomi.mipush.sdk.MiPushClient.getRegId(Unknown Source:4)
    java.lang.reflect.Method.invoke(Native Method)
    com.huawei.hms.analytics.at.lmn(Unknown Source:17)
    com.huawei.hms.analytics.bl.getPushTokenEventJson(Unknown Source:171)
    com.huawei.hms.analytics.framework.c.c.a(Unknown Source:12)
    com.huawei.hms.analytics.framework.c.h.run(Unknown Source:39)
    com.huawei.hms.analytics.framework.f.a$a.run(Unknown Source:4)
    java.util.concurrent.ThreadPoolExecutor.processTask(ThreadPoolExecutor.java:1187)
    java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
    java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
    java.lang.Thread.run(Thread.java:784)

备注说明

  • 去掉APM配置,就不再获取AndroidID
  • 反复尝试过几次,添加和去掉APM,每次都能复现,复现率100%
  • 测试手机型号:华为P10(VTR-AL00/全网通)
  • 系统版本:9.1.0.231(C00E90R1P13) GPU Turbo

APMS.getInstance().start(applicationContext)是否可以手动调用

用户同意隐私协议之后,通过查看日志发现APM没有立即采集数据,必须调用start方法才开始调用

APMS.getInstance().enableCollection(true)
APMS.getInstance().enableAnrMonitor(true)
APMS.getInstance().start(applicationContext)

想问一下这么写可不可以,是否会触发内存泄漏等问题

Cannot use @TaskAction annotation on method IncrementalTransformTask.transform() because interface org.gradle.api.tasks.incremental.IncrementalTaskInputs is not a valid parameter to an action method.

版本:'com.android.tools.build:gradle:7.4.2'
gradle-wrapper.properties中gradle版本gradle-8.1.1-all

编译失败:

  • What went wrong:
    A problem occurred evaluating root project 'android'.

A problem occurred configuring project ':app'.
Could not create task ':app:transformClassesWithAPMSPluginForDebug'.
> Cannot use @TaskAction annotation on method IncrementalTransformTask.transform() because interface org.gradle.api.tasks.incremental.IncrementalTaskInputs is not a valid parameter to an action method.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.