File tree Expand file tree Collapse file tree
rollbar-android/src/main/java/com/rollbar/android Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package com .rollbar .android ;
2+
3+ import android .app .Activity ;
4+ import android .app .Application ;
5+ import android .os .Bundle ;
6+
7+ import com .rollbar .api .payload .data .Level ;
8+ import com .rollbar .api .payload .data .Source ;
9+ import com .rollbar .notifier .telemetry .TelemetryEventTracker ;
10+
11+ class TelemetryNavigationCallbacks implements Application .ActivityLifecycleCallbacks {
12+ private final TelemetryEventTracker telemetryEventTracker ;
13+ private String lastActivity ;
14+
15+ TelemetryNavigationCallbacks (TelemetryEventTracker telemetryEventTracker ) {
16+ this .telemetryEventTracker = telemetryEventTracker ;
17+ }
18+
19+ @ Override
20+ public void onActivityResumed (Activity activity ) {
21+ String current = activity .getClass ().getSimpleName ();
22+
23+ if (lastActivity != null && !lastActivity .equals (current )) {
24+ telemetryEventTracker .recordNavigationEventFor (
25+ Level .INFO ,
26+ Source .CLIENT ,
27+ lastActivity ,
28+ current
29+ );
30+ }
31+
32+ lastActivity = current ;
33+ }
34+
35+ @ Override
36+ public void onActivityCreated (Activity activity , Bundle savedInstanceState ) {}
37+
38+ @ Override
39+ public void onActivityStarted (Activity activity ) {}
40+
41+ @ Override
42+ public void onActivityPaused (Activity activity ) {}
43+
44+ @ Override
45+ public void onActivityStopped (Activity activity ) {}
46+
47+ @ Override
48+ public void onActivitySaveInstanceState (Activity activity , Bundle outState ) {}
49+
50+ @ Override
51+ public void onActivityDestroyed (Activity activity ) {}
52+ }
You can’t perform that action at this time.
0 commit comments