Enable opt-in reporting
By default, Crashlytics automatically collects crash reports for all your app's users. To give users more control over the data they send, you can enable opt-in reporting for your users by disabling automatic collection and initializing Crashlytics only for selected users:
- Turn off automatic collection by adding a new key to your Info.plist file:
- Key: FirebaseCrashlyticsCollectionEnabled
- Value: false
- Enable collection for select users by calling the Crashlytics data collection override at runtime. The override value persists across launches of your app so Crashlytics can automatically collect reports. To opt out of automatic crash reporting, pass false as the override value. When set to false, the new value does not apply until the next run of the app.
Crashlytics.crashlytics().setCrashlyticsCollectionEnabled(true)
How can we do this code for b4i?
I initialized first iFirebaseCrashlytics library and then:
B4X:
#PlistExtra: <key>FirebaseCrashlyticsCollectionEnabled</key><false/>
B4X:
Private Sub GetCrashlytics As NativeObject
Dim no As NativeObject
no.Initialize("Crashlytics").RunMethod("crashlytics", Null)
Return no
End Sub
B4X:
GetCrashlytics.RunMethod("setCrashlyticsCollectionEnabled", Array(True))
i get this error
B4X:
Error occurred on line: 162 (settings)
Method not found: crashlytics, target: Crashlytics
Stack Trace: (
CoreFoundation <redacted> + 252
libobjc.A.dylib objc_exception_throw + 56
CoreFoundation <redacted> + 0
result +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 368
result -[B4INativeObject RunMethod::] + 216
CoreFoundation <redacted> + 144
CoreFoundation <redacted> + 292
result +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1608
result -[B4IShell runVoidMethod] + 232
result -[B4IShell raiseEventImpl:method:args::] + 1800
result -[B4IShellBI raiseEvent:event:params:] + 1580
result +[B4IDebug delegate:::] + 80
result -[b4i_settings _getcrashlytics] + 208
result -[ResumableSub_settings_ConsentStateAvailable resume::] + 3444
CoreFoundation <redacted> + 144
CoreFoundation <redacted> + 292
result +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1608
result -[B4IShell runMethod:] + 448
result -[B4IShell raiseEventImpl:method:args::] + 2172
result -[B4IShellBI raiseEvent:event:params:] + 1580
Last edited: