Android SDK
Integrate Instalog into your Android applications
Installation
Add the Instalog dependency to your project.
Gradle (build.gradle)
Maven (pom.xml)
Initialization
Initialize the SDK in your Application class or MainActivity:
With Additional Configuration
For more control, you can configure the SDK with additional options:
Note: Some InstalogOptions features are disabled by default for performance reasons. You’ll need to explicitly enable them based on your application’s requirements.
Basic Usage
1. Log Events
Track user actions and events in your app:
2. User Identification
Identify users to track their activity across sessions:
3. Feedback Collection
Show a feedback modal to collect user feedback:
4. Crash Reporting
Crash reporting is automatically enabled after initialization. No additional setup is required.
Advanced Features
Custom Alert Handler
Implement a custom alert handler to control how alerts are displayed:
Manual Crash Simulation
Simulate crashes for testing purposes:
Manual Crash Reporting
Send crash reports manually when you catch exceptions:
Best Practices
- Initialize the SDK as early as possible in your application lifecycle
- Identify users as soon as they log in
- Use descriptive event names and consistent parameter names
- Test crash reporting in a controlled environment before production
- Handle user feedback promptly and professionally
Troubleshooting
Common Issues
-
SDK not initialized
- Ensure you call
initialize()
before using other methods - Verify your API key is correct
- Ensure you call
-
Events not being tracked
- Check your internet connection
- Verify event names and parameters are valid
-
Crash reports not appearing
- Ensure the SDK is initialized before any crashes occur
- Check for proper permissions
For additional support, contact our developer support team at [email protected]
API Reference
Instalog Class
Method | Description |
---|---|
initialize(key: String, context: Context, handler: InstalogAlertDialogHandler? = null, options: InstalogOptions? = null) | Initializes the SDK with optional custom alert handler and configuration options |
logEvent(context: Context, log: InstalogLogModel) | Logs an event |
identifyUser(id: String) | Identifies the current user |
showFeedbackModal(context: Context) | Shows feedback collection UI |
sendCrash(string: error, stack: String) | Manually sends a crash report for a caught exception |
getInstance(): Instalog | Gets the singleton instance |
Options
Option | Type | Default | Description |
---|---|---|---|
isCrashEnabled | boolean | false | Enable crash reporting |
isFeedbackEnabled | boolean | false | Enable user feedback collection |
isLogEnabled | boolean | false | Enable event logging |
isLoggerEnabled | boolean | false | Enable console logging |
Models
InstalogLogModel
: Represents a log eventInstalogCrashModel
: Represents crash dataInstalogFeedbackModel
: Represents user feedback