I have a question about how to apply FirebaseAnalytics.SetConsent

45 Views Asked by At

I am developing with Unity. Recently, I was informed that I need to apply consent mode in Firebase Analytics. I checked the related guide, but I couldn't find a guide for Unity, so I don't know if I applied it correctly.

Write down the implemented code as well. According to the guide, when the implementation is done correctly: 'ConsentSettings: adStorage=granted, analyticsStorage=granted' They say I need to check these logs, but I don't see them.

I would like to know if I did something wrong or if I am missing something.

Thank you in advance.

https://developers.google.com/tag-platform/security/guides/app-consent?platform=android&hl=ko#kotlin

Firebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task =>
{
var dependencyStatus = task.Result;
if (dependencyStatus == Firebase.DependencyStatus.Available)

// Create and hold a reference to your FirebaseApp,
// where app is a Firebase.FirebaseApp property of your application class.
Crashlytics will use the DefaultInstance, as well;
this ensures that Crashlytics is initialized.
Firebase.FirebaseApp app = Firebase.FirebaseApp.DefaultInstance;

Set a flag here for indicating that your project is ready to use Firebase.

var FC_Consent = new Dictionary<ConsentType, ConsentStatus>();
FC_Consent.Add(ConsentType.AnalyticsStorage, ConsentStatus.Granted);
FC_Consent.Add(ConsentType.AdStorage, ConsentStatus.Granted);

FirebaseAnalytics.SetConsent(FC_Consent);
FirebaseAnalytics.SetAnalyticsCollectionEnabled(true);
}
else
{
UnityEngine.Debug.LogError(System.String.Format(
"Could not resolve all Firebase dependencies: {0}", dependencyStatus));
// Firebase Unity SDK is not safe to use here.
}
});

I tried to implement it according to the guide and expected the results that the guide said.

0

There are 0 best solutions below