Google Analytics V4 - bool configuration name not recognized

I see this in Logcat:

W/GAV4: String xml configuration name not recognized: ga_trackingId W/GAV4: Bool xml configuration name not recognized: ga_autoActivityTracking W/GAV4: Bool configuration name not recognized: ga_reportUncaughtExceptions 

In Manifest.xml, I have:

  <meta-data android:name="com.google.android.gms.analytics.globalConfigResource" android:resource="@xml/track" /> 

In App.java:

  GoogleAnalytics analytics = GoogleAnalytics.getInstance(this); Tracker t = analytics.newTracker(R.xml.track); 

In track.xml:

 <?xml version="1.0" encoding="utf-8"?> <resources> <string name="ga_trackingId">UA-****</string> <string name="ga_logLevel">error</string> <bool name="ga_autoActivityTracking">true</bool> <bool name="ga_reportUncaughtExceptions">true</bool> <bool name="ga_dryRun">false</bool> <integer name="ga_dispatchPeriod">120</integer> </resources> 

Are boolean parameters ignored in the configuration file?

+6
source share
1 answer

You can remove the metadata from the manifest and delete the track.xml file. Instead, configure it from the code as follows:

 final String trackingId = MyApplication.DEBUG ? AnalyticsManager.GA_TRACKING_ID_DEBUG : AnalyticsManager.GA_TRACKING_ID_PROD; final int versionCode = BuildConfigHelper.VERSION_CODE; this.mDefaultTracker = analytics.newTracker(trackingId); this.mDefaultTracker.enableAdvertisingIdCollection(true); this.mDefaultTracker.enableAutoActivityTracking(false); this.mDefaultTracker.enableExceptionReporting(false); this.mDefaultTracker.setSessionTimeout(300); this.mDefaultTracker.set("&av", String.valueOf(versionCode)); 
0
source

Source: https://habr.com/ru/post/988392/


All Articles