AppDynamics Application Intelligence Platform

3.9.x Documentation

PDFs

Learn by Watching

Doc Maps

Skip to end of metadata
Go to start of metadata

Once you have instrumented your Android application with the Mobile Android SDK, you can also use the APIs exposed by the SDK to customize the data for your app that appears in the Controller UI, under the Custom Data tab.  

Download the JavaDocs

A complete zipped version of the JavaDocs for the SDK can be downloaded from here.

The Instrumentation class contains the methods that are of interest.

Extend the Mobile Agent

You can use methods available in the Instrumentation class to collect three additional types of data.

Info Points

Information points allow you to track how your own code is running.  You can see how often a single method is invoked, and how long it takes to run, using  beginCall and endCall. For example, to collect information on your downloadImage method, you could use code similar to this:

private void downloadImage(URL url) {
     CallTracker tracker = null;
     try {
         tracker = Instrumentation.beginCall("com.example.android.awesomeapp.ImageDownloader", "downloadImage", url);
         //download image.
     } finally {
         Instrumentation.endCall(tracker);
     }
 }

Beginning with version 3.9.2, you can use an annotation, @InfoPoint, to create an information point on any method.  For example:

@InfoPoint
 public void infoPointMethod(String arg1, int arg2, long value) {
   System.out.println("Executing infoPointMethod!");
 }
 

Custom Timers

Custom timers allow you to time any arbitrary sequence of events within your code, even spanning multiple methods, by using startTimer and stopTimer.

public class MyActivity extends Activity {
   @Override
   protected void onStart(){
       Instrumentation.startTimer("Time Spent on MyActivity");
       //your code here.
   }

   @Override
   protected void onStop(){
       Instrumentation.stopTimer("Time Spent on MyActivity");
       //your code here.
   }
 }

(info) startTimer(String) and stopTime(String) can be called from different threads.

Custom Metrics

Any integer-based data can be passed to the agent.  The first parameter to the report.Metric call is the name you want the metric to appear under in the Controller UI. For example, to track the number of times your users click the checkout button in your UI, you could use code similar to this.

findViewById(R.id.checkout_button).setOnClickListener(new View.OnClickListener(){
      @Override
      public void onClick(View view){
          //run your checkout routine.
          Instrumentation.reportMetric("Checkout Count", 1);
      }
 });

Set Up the Agent for an On-Premise EUEM Processor

By default the agent is configured to send its beacons to the EUEM Cloud, which is an instance of the EUEM Processor running on AWS.  If you wish to instrument your app in an environment that is using an on-prem version of the Processor, you need to modify the URL to which the agent sends its data.  You do this using the second version of the start method listed in the JavaDocs, using the collectorURL parameter.

 

 

 

 

 

 

 

  • No labels