Android Question New Crashlytics how to disable reporting before get consent from user?

Pendrush

Well-Known Member
Licensed User
Longtime User
This post explain how to integrate new Crashlytics into our app.
The question is how to implement the library but so that it does not send data to the google server before we get the user's consent?
The issue is related to the GDPR law, which requires that the consent of the user be required before sending the data.
The law also strictly prohibits the sending of any data if the user is a child.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
@Pendrush question is correct. There is nothing to initialize with the new crashlytics. It works automatically.

Based on the the instructions:

Manifest editor:
B4X:
AddApplicationText(<meta-data
    android:name="firebase_crashlytics_collection_enabled"
    android:value="false" />
)

Code:
B4X:
Public Sub CLLog(msg As String)
    GetCrashlytics.RunMethod("log", Array(msg))
    Log(msg)
End Sub

Private Sub GetCrashlytics As JavaObject
    Dim jo As JavaObject
    jo = jo.InitializeStatic("com.google.firebase.crashlytics.FirebaseCrashlytics").RunMethod("getInstance", Null)
    Return jo
End Sub

Enable:
B4X:
GetCrashlytics.RunMethod("setCrashlyticsCollectionEnabled", Array(True))
 
Upvote 0

yiankos1

Well-Known Member
Licensed User
Longtime User


How can we do it for iOS?
 
Upvote 0

Andrew (Digitwell)

Well-Known Member
Licensed User
Longtime User
How can we do it for iOS?

the B4i version seems to have an initialize function so you can use the method DonManfred suggested.


 
Upvote 0

yiankos1

Well-Known Member
Licensed User
Longtime User
But lib mentions
Initializes the library inside the Application_Start function.
.
You can change your preference about GDPR at settings menu(which is not at Application_Start sub). This could be a problem?
 
Upvote 0

Andrew (Digitwell)

Well-Known Member
Licensed User
Longtime User
I think Application_start is suggested so that Crashlytics is running as early as possible. You could do this elsewhere.

Turning off Crashlytics once initalised does look like a problem. Perhaps @Biswajit can help?
 
Upvote 0

Biswajit

Active Member
Licensed User
Longtime User
How can we do it for iOS?
This wrapper uses old SDK. Will post the new version soon. For now do this,
B4X:
#PlistExtra: <key>firebase_crashlytics_collection_enabled</key><false/>
B4X:
Public Sub CLLog(msg As String)
    GetCrashlytics.RunMethod("CLS_LOG:", Array(msg))
    Log(msg)
End Sub

Private Sub GetCrashlytics As NativeObject
    Dim no As NativeObject
    no = no.Initialize("Crashlytics").RunMethod("sharedInstance", Null)
    Return no
End Sub
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…