Appxiom Activity Markers & Lifecycle Tracking
Add custom activity markers and automatically capture lifecycle events in your Android applications. The Appxiom SDK provides comprehensive activity tracking to help debug issues and understand user behavior patterns.
Overview
Activity markers are custom events that you can set throughout your Android application to track user interactions, business logic flow, and important application states. Combined with automatic lifecycle tracking, they provide a complete picture of your app's behavior when issues occur.
Key Capabilities
- Custom Event Tracking: Add custom markers anywhere in your application
- Automatic Lifecycle Capture: Built-in tracking of Activity and Fragment lifecycle events
- Chronological Activity Trail: View events in the exact order they occurred
- Memory Context: Each marker includes memory usage information
- Debug-Only Markers: Special markers active only during debug environments
- Obfuscation Support: Maintain readable class names in production builds
Automatic Lifecycle Tracking
The Appxiom SDK automatically captures standard Android lifecycle events without any additional code:
- Activity lifecycle methods (
onCreate,onStart,onResume,onPause,onStop,onDestroy) - Fragment lifecycle events
- Memory usage at each lifecycle transition
Extended Tracking Options
For comprehensive tracking across different UI frameworks:
- Jetpack Compose: Follow Track Jetpack Compose guide for Compose screen tracking
- Activity Logging: Use Integrate Log Function to add detailed log data to activity trails
Setting Custom Activity Markers
Activity Markers
Add custom markers anywhere in your application using Ax.setActivityMarker(). These markers appear alongside lifecycle events when issues are reported.
- Java
- Kotlin
// Track user interactions
Ax.setActivityMarker(PurchaseActivity.this, "clicked on payment_package_two");
// Track business logic events
Ax.setActivityMarker(this, "user_authentication_completed");
// Track navigation events
Ax.setActivityMarker(MainActivity.this, "navigated_to_settings");
// Track user interactions
Ax.setActivityMarker(this@PurchaseActivity, "clicked on payment_package_two")
// Track business logic events
Ax.setActivityMarker(this, "user_authentication_completed")
// Track navigation events
Ax.setActivityMarker(this@MainActivity, "navigated_to_settings")
Activity Marker Properties
- Unlimited Markers: No limit on the number of custom markers that can be set. Each issue report will include a maximum of 60 markers including auto captured lifecycle markers captured before an issue occurrence.
- Efficient Storage: Markers are only sent to the server when an issue occurs
- Chronological Order: All markers are displayed in the exact sequence they occurred
- Memory Context: Each marker includes the device's free memory percentage at that moment
Activity Trail Visualization
When an issue is reported, the activity trail shows a complete timeline of events leading up to the problem:
ActivityWelcome:onCreate 11:19:24:469 45.79% FREE MEMORY
MapActivity:onCreate 11:19:24:708 44.39%
MapActivity:onStart 11:19:26:983 45.55%
MapActivity:onResume 11:19:27:012 45.19%
ActivityWelcome:onDestroy 11:19:28:515 44.53%
MapActivity:onPause 11:20:17:806 50.45%
PurchaseActivity:onCreate 11:20:18:106 55.19%
PurchaseActivity:onStart 11:20:18:404 55.43%
PurchaseActivity:onResume 11:20:18:906 55.23%
PurchaseActivity:clicked on payment_package_two 11:20:24:235 55.20%
Understanding the Trail Format
Each entry contains:
- Class:Event: The activity/fragment class and the specific event
- Timestamp: Precise time when the event occurred
- Memory Usage: Percentage of free memory available at that moment
Debug-Only Activity Markers
For development and testing purposes, you can set markers that are only active in debug builds using Ax.setActivityMarkerForDebug().
Debug Marker Benefits
- Development Insights: Track debugging-specific events without affecting production
- Performance Testing: Monitor development-only code paths
- Zero Production Impact: Automatically excluded from release builds
- Java
- Kotlin
// Debug-only markers for development tracking
Ax.setActivityMarkerForDebug(this, "User opened invoice");
Ax.setActivityMarkerForDebug(this, "Debug: API response received");
Ax.setActivityMarkerForDebug(this, "Test: User interaction completed");
// Debug-only markers for development tracking
Ax.setActivityMarkerForDebug(this@PurchaseActivity, "User opened invoice")
Ax.setActivityMarkerForDebug(this, "Debug: API response received")
Ax.setActivityMarkerForDebug(this, "Test: User interaction completed")
Handling Code Obfuscation
When using ProGuard, R8, or other code obfuscation tools, class names in activity trails may become unreadable. The @AX annotation solves this by providing custom identifiers.
Using @AX Annotation
Apply the @AX annotation to any class to provide a readable identifier in the activity trail:
- Java
- Kotlin
@AX(id = "GalleryFragmentClass")
public class GalleryFragment extends Fragment {
// Fragment implementation
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// This will appear as "GalleryFragmentClass:onCreate" in the trail
}
}
@AX(id = "UserProfileActivity")
public class ProfileActivity extends AppCompatActivity {
// Activity implementation
}
@AX(id = "GalleryFragmentClass")
class GalleryFragment: Fragment() {
// Fragment implementation
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// This will appear as "GalleryFragmentClass:onCreate" in the trail
}
}
@AX(id = "UserProfileActivity")
class ProfileActivity: AppCompatActivity() {
// Activity implementation
}
Obfuscation Best Practices
- Use Descriptive IDs: Choose meaningful names that clearly identify the class purpose
- Hardcoded Strings: Always use string literals (not variables) for the
idparameter - Consistent Naming: Maintain a consistent naming convention across your app
- Document Mappings: Keep internal documentation of your custom IDs for team reference, if required
- ProGuard/R8 Rules: Ensure your ProGuard or R8 configuration preserves the
@AXannotation
Integration with Other Features
Activity markers work seamlessly with other Appxiom SDK features:
- Memory Detection: Markers include memory context for performance analysis
- Crash Reporting: Activity trails are included with crash reports
- ANR Detection: Trails help identify what led to Application Not Responding issues
- Custom Logging: Combine with log integration for detailed debugging