tl;dr
Is there a way to programatically enable reportUncaughtExceptions for Google Analytics (v4) without using the xml config in Android?
Longer explanation
I'm using Google Analytics v4 in an Android app, and I need a way to set two different tracking ids by build flavor. I was using a general global_tracker.xml configuration (see below), though I need a way to "dynamically inject" the tracking id based on flavor.
<resources xmlns:tools="http://schemas.android.com/tools"
tools:ignore="TypographyDashes">
<integer name="ga_sessionTimeout">300</integer>
<bool name="ga_autoActivityTracking">true</bool>
<bool name="ga_reportUncaughtExceptions">true</bool>
<!-- The following value should be replaced with correct property id. -->
<string name="ga_trackingId">UA-xxxxxx-xx</string>
</resources>
In order to avoid having duplicate xml configs in the build flavor source folders, I initialize a tracker directly using the trackingId and set the attributes programatically.
mGATracker = analytics.newTracker(R.string.ga_code); // this is dynamic depending on flavor
mGATracker.setSessionTimeout(300);
mGATracker.enableAutoActivityTracking(true);
Is there a way to enable reportUncaughtExceptions without using the xml config?