-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fa5f967
commit a2556ec
Showing
4 changed files
with
33 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...java/com/example/jetpack_compose_all_in_one/firebase/crashanalytics/CrashAnalyticsDemo.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.example.jetpack_compose_all_in_one.firebase.crashanalytics | ||
|
||
import androidx.compose.runtime.Composable | ||
import com.google.firebase.crashlytics.FirebaseCrashlytics | ||
|
||
@Composable | ||
fun CrashAnalyticsDemo() { | ||
// Simulate a crash for demonstration purposes | ||
simulateCrash() | ||
|
||
// Log a message to Crashlytics | ||
FirebaseCrashlytics.getInstance().log("CrashAnalyticsDemo() called") | ||
|
||
// You can log additional information | ||
FirebaseCrashlytics.getInstance().setCustomKey("priority", "high") | ||
|
||
// Report non-fatal exceptions | ||
val exception = Exception("Non-fatal exception occurred") | ||
FirebaseCrashlytics.getInstance().recordException(exception) | ||
|
||
// You may also use setUserId() to associate users with crashes | ||
|
||
// Your UI Composables can go here | ||
} | ||
|
||
private fun simulateCrash() { | ||
// Simulate a crash | ||
throw RuntimeException("This is a simulated crash") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters