TP-80791 | Pulse SDK Integration

This commit is contained in:
yashmantri
2024-09-03 17:38:30 +05:30
parent 558d716113
commit 69e989c55d
3 changed files with 20 additions and 1 deletions

View File

@@ -321,6 +321,9 @@ dependencies {
implementation(platform("com.google.firebase:firebase-bom:32.2.3"))
implementation("com.google.firebase:firebase-config-ktx")
implementation("com.google.firebase:firebase-analytics-ktx")
implementation 'com.navi.android:pulse:1.6.0'
// debugImplementation 'com.github.chuckerteam.chucker:library:4.0.0'
// implementation 'com.github.chuckerteam.chucker:library-no-op:4.0.0'
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules

View File

@@ -30,7 +30,6 @@
<uses-permission android:name="android.permission.POST_NOTIFICATION" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"

View File

@@ -96,6 +96,18 @@ public class MainApplication extends Application implements ReactApplication {
AlfredConfig alfredConfig = new AlfredConfig(BuildConfig.APP_NAME, String.valueOf(BuildConfig.VERSION_CODE),
BuildConfig.VERSION_NAME, BuildConfig.BUILD_FLAVOR, BuildConfig.API_KEY);
AlfredManager.INSTANCE.init(alfredConfig, this);
PulseSDKConfig.Configuration pulseConfig =
new PulseSDKConfig.Configuration.Builder()
.setAppName(BuildConfig.APP_NAME)
.setAppVersion(String.valueOf(BuildConfig.VERSION_CODE))
.setAppVersionName(BuildConfig.VERSION_NAME)
.setDestinationUrl("https://janus.prod.navi-tech.in/")
.setEventBatchSize(1)
.setEventInterval(2000)
.build();
PulseManager.INSTANCE.init(pulseConfig, this, null);
setupAlfredANRWatchDog(alfredConfig);
setupAlfredCrashReporting(alfredConfig);
@@ -144,6 +156,9 @@ public class MainApplication extends Application implements ReactApplication {
}
private void setupAlfredANRWatchDog(AlfredConfig alfredConfig) {
Map<String, String> test = new HashMap<>();
test.put(SCREEN_NAME, BuildConfig.APP_NAME);
// PulseManager.INSTANCE.trackEvent("COSMOS_TEST", test);
new ANRWatchDog().setIgnoreDebugger(true).setReportMainThreadOnly().setANRListener(error -> {
if (error.getCause().getStackTrace().length == 0) {
return;
@@ -157,6 +172,7 @@ public class MainApplication extends Application implements ReactApplication {
if (isAlfredEnabledFromFirebase && AlfredManager.INSTANCE.isAlfredRecordingEnabled()
&& alfredConfig.getAnrEnableStatus()) {
anrEventProperties.put(STACK_TRACE, error.getCause().getStackTrace()[0].toString());
PulseManager.INSTANCE.trackEvent("COSMOS_ANR", anrEventProperties);
AlfredManager.INSTANCE.handleAnrEvent(anrEventProperties);
}
}).start();
@@ -184,6 +200,7 @@ public class MainApplication extends Application implements ReactApplication {
if (stackTraceElement != null) {
crashEventProperties.put(STACK_TRACE, stackTraceElement.toString());
}
PulseManager.INSTANCE.trackEvent("COSMOS_CRASH", crashEventProperties);
AlfredManager.INSTANCE.handleCrashEvent(crashEventProperties);
}
} finally {