Skip to content

Dynatrace/Native-Android-Sample-Application

Dynatrace Android Tutorial Application

Note This product is not officially supported by Dynatrace!


Table of Contents


About

This Sample Android Mobile App is a tutorial for Dynatrace Mobile Monitoring that can be instrumented and run on Android Emulators or devices.

While the app itself serves as a tutorial that users can run and learn from directly, it was designed to be easy to use and by having access to the source code of the application, users can see exactly which methods and calls translate into the session data visible in the UI

Helpful Documentation & Resources

Covered in this tutorial

  • Data Privacy
    • DataCollectionLevel and User opt-in
    • User Tagging
  • User Action Monitoring
    • Automatic Instrumentation
    • Action Naming
    • Modifying Actions with SDK
    • Manual Instrumentation & Custom Actions
  • Web Request Monitoring
    • Standalone web requests (requests with no linked user action)
    • Linked web requests (requests that are linked to user actions)
    • Manually tag and monitor web requests
  • Crash Analysis & Session Replay
    • Report Crashes
    • Configure Masking for Session Replay
  • Data & Metrics
    • Reporting Errors, Events, and Values
    • Create User Action and User Session Properties
  • Advanced Topics
    • Adding Custom HTTP Headers to Beacon Values

Pre-requisites

  • Android Studio Installed & Android 13 SDK (API 33) or higher installed
    • Android Studio > Tools > SDK Manager
  • Android Emulator OR Physical Device with USB Debugging Enabled
  • Dynatrace Tenant with a Mobile Application created in the UI
    • Session Replay must be enabled: (Dynatrace UI Mobile App Settings) General > Enablement and cost control


Initial Setup

  1. Download & Open with Android Studio, and set project view to 'Android'

  1. Open the Project build.gradle file and follow the steps 1-3 from the Instrumentation Wizard (Mobile App in Dynatrace > ... > Settings > Instrumentation Wizard)
    • NOTE: SKIP STEP 4! The code snippet required to enable data collection when UserOptIn is enabled has already been implemented in the class DataPrivacySettingsFragment.java

  1. Add the line exclude.classes "com.dynatrace.sample.android.app.ManualWebRequest" to the sampleConfig section of the Agent configuration that was added in the last step
    • Manually instrumenting web requests that are automatically instrumented is not supported, and automatic instrumentation of web requests is enabled by default, so in order to provide an example for manually instrumenting web requests, a separate class was created that needs to be excluded from automatic instrumentation

  1. Build and Run the app
    • File > Sync Project with Gradle Files (Wait for this to complete)
    • Run > Run 'app'

  1. Enable sending of Data for the agent since UserOptIn is enabled
    • Click on Begin Tutorial or open the navigation with the hamburger menu in the top-left corner of the app and press Data-Privacy Settings
    • Toggle the switch that's labeled User-Behavior to enable sending of data


About

Sample Mobile Application with Guide to Instrument with Dynatrace

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages