Updated documentation to match latest Firebase changes
This commit is contained in:
parent
262b02cb2b
commit
1ef1d6f079
|
@ -2,6 +2,7 @@ package io.invertase.firebase.crash;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.facebook.react.bridge.Promise;
|
||||||
import com.facebook.react.bridge.ReactMethod;
|
import com.facebook.react.bridge.ReactMethod;
|
||||||
import com.facebook.react.bridge.ReactApplicationContext;
|
import com.facebook.react.bridge.ReactApplicationContext;
|
||||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||||
|
@ -37,4 +38,15 @@ public class RNFirebaseCrash extends ReactContextBaseJavaModule {
|
||||||
public void report(String message) {
|
public void report(String message) {
|
||||||
FirebaseCrash.report(new Exception(message));
|
FirebaseCrash.report(new Exception(message));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ReactMethod
|
||||||
|
public void setCrashCollectionEnabled(Boolean enabled) {
|
||||||
|
FirebaseCrash.setCrashCollectionEnabled(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ReactMethod
|
||||||
|
public void isCrashCollectionEnabled(Promise promise) {
|
||||||
|
Boolean isEnabled = FirebaseCrash.isCrashCollectionEnabled();
|
||||||
|
promise.resolve(isEnabled);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,9 @@ own app. The Firebase SDK includes a number of pre-set events which are automati
|
||||||
'app_update',
|
'app_update',
|
||||||
'error',
|
'error',
|
||||||
'first_open',
|
'first_open',
|
||||||
|
'first_visit',
|
||||||
|
'first_open_time',
|
||||||
|
'first_visit_time',
|
||||||
'in_app_purchase',
|
'in_app_purchase',
|
||||||
'notification_dismiss',
|
'notification_dismiss',
|
||||||
'notification_foreground',
|
'notification_foreground',
|
||||||
|
@ -16,7 +19,14 @@ own app. The Firebase SDK includes a number of pre-set events which are automati
|
||||||
'notification_receive',
|
'notification_receive',
|
||||||
'os_update',
|
'os_update',
|
||||||
'session_start',
|
'session_start',
|
||||||
|
'screen_view',
|
||||||
'user_engagement',
|
'user_engagement',
|
||||||
|
'ad_impression',
|
||||||
|
'ad_click',
|
||||||
|
'ad_query',
|
||||||
|
'ad_exposure',
|
||||||
|
'adunit_exposure',
|
||||||
|
'ad_activeiew',
|
||||||
```
|
```
|
||||||
|
|
||||||
#### `logEvent(event: string, params?: Object): void`
|
#### `logEvent(event: string, params?: Object): void`
|
||||||
|
|
|
@ -2,6 +2,25 @@
|
||||||
|
|
||||||
RNFirebase provides crash reporting for your app out of the box. Please note crashes do not appear in real-time on the console, they tend to take a number of hours to appear.
|
RNFirebase provides crash reporting for your app out of the box. Please note crashes do not appear in real-time on the console, they tend to take a number of hours to appear.
|
||||||
|
|
||||||
|
## Enabling/Disabling Crash Reporting
|
||||||
|
|
||||||
|
By default crash reporting is enabled. If you want to disable reporting, call `setCrashCollectionEnabled(enabled: Boolean)`:
|
||||||
|
|
||||||
|
```js
|
||||||
|
firebase.crash().setCrashCollectionEnabled(false);
|
||||||
|
```
|
||||||
|
|
||||||
|
To check if crash reporting is currently enabled, call `isCrashCollectionEnabled(): Promise<boolean>`:
|
||||||
|
|
||||||
|
```js
|
||||||
|
firebase.crash().isCrashCollectionEnabled()
|
||||||
|
.then((enabled) => {
|
||||||
|
if (enabled) {
|
||||||
|
console.log('Crash Reporting is currently enabled');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
## Manual Crash Reporting
|
## Manual Crash Reporting
|
||||||
|
|
||||||
If you want to manually report a crash, such as a pre-caught exception this is possible by using the `report` method.
|
If you want to manually report a crash, such as a pre-caught exception this is possible by using the `report` method.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
export default function addTests({ describe, fdescribe, it, firebase }) {
|
export default function addTests({ describe, it, firebase }) {
|
||||||
|
|
||||||
fdescribe('API', () => {
|
describe('API', () => {
|
||||||
it('it should set collection enabled/disabled', () => {
|
it('it should set collection enabled/disabled', () => {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
firebase.native.crash().setCrashCollectionEnabled(false);
|
firebase.native.crash().setCrashCollectionEnabled(false);
|
||||||
|
|
Loading…
Reference in New Issue