dotnet/android-libraries

Some methods require a parameter of type Java.Lang.Boolean instead of .NET Boolean in Firebase Crashlytics and Perf bindings

Opened this issue · 3 comments

Android application type

Android for .NET (net6.0-android, etc.)

Affected platform version

.NET 8.0.402

Description

There are two methods which I currently know of that require a parameter of type Java.Lang.Boolean rather than .NET Boolean.

In Xamarin.Firebase.Crashlytics v119.1.0, FirebaseCrashlytics.Instance.SetCrashlyticsCollectionEnabled expects a Java.Lang.Boolean? parameter while v119.0.3.1 had a .NET Boolean parameter.

FirebasePerformance.Instance.SetPerformanceCollectionEnabled of Xamarin.Firebase.Perf has the same issue as well where it expects a Java.Lang.Boolean instead of a .NET Boolean type, but this has been like this for quite a while.

Steps to Reproduce

  1. Add Xamarin.Firebase.Crashlytics v119.1.0 or Xamarin.Firebase.Perf v121.0.0
  2. Call the above mentioned methods in Description
  3. See that they require a parameter of type Java.Lang.Boolean instead of a .NET Boolean

Did you find any workaround?

Use Java.Lang.Boolean.ValueOf()

Relevant log output

No response

Thanks for the feedback.

Some investigation is needed in order to give correct answer.

The parameter type is Java.Lang.Boolean? because the Java API takes a java.lang.Boolean:

Consider FirebaseCrashlytics#setCrashlyticsCollectionEnabled(java.lang.Boolean).

Additionally, note the documentation for that method, which explicitly calls out null as a value:

whether to enable or disable automatic data collection. When set tofalse, the new value does not apply until the next run of the app. When set to null, the override is cleared and automatic data collection settings are determined by the configuration in your AndroidManifest.xml or other Firebase-wide settings.

We're not special-casing anything here. We're just binding the API, as-is.

The parameter type is Java.Lang.Boolean? because the Java API takes a java.lang.Boolean:

Consider FirebaseCrashlytics#setCrashlyticsCollectionEnabled(java.lang.Boolean).

Additionally, note the documentation for that method, which explicitly calls out null as a value:

whether to enable or disable automatic data collection. When set tofalse, the new value does not apply until the next run of the app. When set to null, the override is cleared and automatic data collection settings are determined by the configuration in your AndroidManifest.xml or other Firebase-wide settings.

We're not special-casing anything here. We're just binding the API, as-is.

Thanks for the clear response!