cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Android Events and actions

Naga
Frequent Guest

Hi Team,

 

We are trying to add the auto instrumentation to our application and we observed in the events and actions in dashboard its been picking up only Activity names, how we can add the configuration to pick up the fragment names also?

 

So it will be easy to track back the class names easily.

 

Thanks 

Naga

6 REPLIES 6

Naga
Frequent Guest

our confgiruation is like below, in base build.gradle file

 

dynatrace {
configurations {
NgaConfig {
autoStart.enabled false
}
}
}

 

and starting the dynatrace in one of the start up fragment of the application

 

Configuration config = new DynatraceConfigurationBuilder(

"<Application ID>",
"<Beacon URL>")
.withDebugLogging(false)
.withCertificateValidation(true)
.withCrashReporting(true)
.buildConfiguration();


Dynatrace.startup(context, config);
Dynatrace.identifyUser(<Random session ID>);

Julius_Loman
DynaMight Guru
DynaMight Guru

Hello @Naga ,

Fragment sensors are disabled by default. I believe you need to enable them in the configuration in the lifecycle monitoring block . See more in the DSL documentation.

Certified Dynatrace Master | Alanata a.s., Slovakia, Dynatrace Master Partner

JoshuaBradbury
Visitor

Hello @Julius_Loman,

 

When enabling the fragment sensors we get this error:
Fragment instrumentation is not available in this version

I assume then that fragment sensors aren't yet available? Any other help is appreciated!

hey @JoshuaBradbury,

I can confirm that automatic monitoring of fragment lifecycle events is not available. But you can manually instrument fragments and report the events via a custom user action. The plugin automatically adds the OneAgent SDK as dependency to your application and no additional setup step is needed.

Hi @Anonymous,

Thank you for the reply, but we are using the Auto instrumentation, in this case how we can pick up the fragment class names?

 

Custom user action -- means do we need to add the below in the fragments, to get the fragment names?? if so what is the point of doing the auto instrumentation ?

 

DTXAction action = Dynatrace.enterAction("Fragment class name");

 

action.leaveAction();

 

Please correct me if my understanding is wrong.

 

Thank you,

Naga

Thomas_Wirth1
Dynatrace Champion
Dynatrace Champion

The term "manually instrument" in my last comment means that you enhance the monitoring data (generated by auto-instrumentation) by instrumenting additional parts of the app via manual calls to the OneAgent SDK. In the official documentation, it is referred to as "Enhance mobile user experience data by using the OneAgent SDK for Android."

 


@Naga wrote:

Custom user action -- means do we need to add the below in the fragments, to get the fragment names?? if so what is the point of doing the auto instrumentation ?


The plugin still uses the other sensors and instrument activities, web requests, user interactions ..., so you don't have to manually instrument them. For fragments, you have do instrument them manually. The instrumentation depends on what you want to monitor (class name, lifecycle events, time duration until the fragment is visible, ...). The provided snippet is a good starting point to get more familiar with the OneAgent SDK. But currently it would only monitor the fragment class name. By adjusting the location of the enterAction and leaveAction method call, you could monitor how long it takes to display/create the fragment. Or you could add lifecycle events via the reportEvent API.