Huawei App Performance Management

  • Automatic performance monitoring.
  • Real-time reports.
  • Custom traces and Indicators.
  • Create a Huawei Developer Account. (link)
  • Set up a project in Android Studio and in the Developer console. (link)
  • Add APM dependency in build.gradle of app module.
implementation 'com.huawei.agconnect:agconnect-apms:1.4.1.302'
  • Add APM plugin in build.gradle of the app module
apply plugin: 'com.huawei.agconnect.apms'
  • Add APM plugin dependency in build.gradle of a project module.
classpath 'com.huawei.agconnect:agconnect-apms-plugin:1.4.1.302'
  • Add the following items to app-level obfuscation configurations.
-keep class com.huawei.agconnect.**{*;}
-dontwarn com.huawei.agconnect.**
-keep class com.hianalytics.android.**{*;}
-keep class com.huawei.updatesdk.**{*;}
-keep class com.huawei.hms.**{*;}
-keep interface com.huawei.hms.analytics.type.HAEventType{*;}
-keep interface com.huawei.hms.analytics.type.HAParamType{*;}
-keepattributes Exceptions, Signature, InnerClasses, LineNumberTable
  • Enable APM service in the AppGallery Console.
  • Create a custom trace
CustomTrace customTrace = APMS.getInstance().createCustomTrace("testTrace");
customTrace.start();
// code that you want to trace
customTrace.stop();
  • Call putProperty() to set custom properties
CustomTrace customTrace = APMS.getInstance().createCustomTrace("testTrace");
customTrace.start();
// update a property for the trace
customTrace.putProperty("Action", "Click");
// code that you want to trace
customTrace.stop();
  • Add custom indicators.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store