Troubleshooting
SDK Not Initializing
Problem: SDK throws errors or events aren't being sent.
Solution:
- Verify API key is not empty
- Enable debug logging:
B2MetricAnalyticsConfig(
apiKey = "YOUR_API_KEY",
b2MetricAnalyticsLogLevel = B2MetricAnalyticsLogLevel.DEBUG
)
- Check Logcat output:
adb logcat | grep B2Metric
Events Not Appearing
Problem: You're tracking events but don't see them in the dashboard.
Common causes:
- Events still in queue — For testing, send events immediately:
B2MetricAnalyticsConfig(
apiKey = "YOUR_API_KEY",
batchSize = 1, // Send immediately
flushIntervalSeconds = 5
)
-
No internet connection — Events are stored locally when offline and sent when connection is restored.
-
Wrong API key — Verify you're using the correct API key from the B2Metric dashboard.
Push Notification Tracking Not Working
FCM checklist:
-
google-services.jsonadded toapp/directory - Firebase configured in Firebase Console
- FCM dependency added to
build.gradle - Service registered in
AndroidManifest.xml -
onNewToken()callsregisterPushToken()
HMS checklist:
-
agconnect-services.jsonadded toapp/directory - Huawei App ID is correct
- HMS Core installed on device