I am creating an application in which I want to see the crash and exception report on the google analytics account.
I am using the following code for this functionality:
"analytics_global_config.xml"
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="ga_appName">app_name</string>
<string name="ga_logLevel">verbose</string>
<integer name="ga_dispatchPeriod">1</integer>
<bool name="ga_dryRun">true</bool>
</resources>
I have declared this xml in the manifest file as follows:
<meta-data
android:name="com.google.android.gms.analytics.globalConfigResource"
android:resource="@xml/analytic_global_config" />
xml file for tracking: "analytics_track.xml" as follows:
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="TypographyDashes">
<string name="ga_trackingId">UA-XXXXXXXX-1
</string>
<bool name="ga_autoActivityTracking">true
</bool>
<bool name="ga_reportUncaughtExceptions">true
</bool>
<string name="ga_sampleFrequency">99.8</string>
<integer name="ga_sessionTimeout">2000</integer>
<bool name="ga_anonymizeIp">true</bool>
In the application class I have used this code as follows:
Tracker tracker = GoogleAnalytics.getInstance(this).(R.xml.analytics_track);
I am getting log on start of application as:
09-23 16:26:57.775: V/GAV4(7763): Thread[main,5,main]: Loading Tracker config values.
09-23 16:26:57.775: V/GAV4(7763): Thread[main,5,main]: [Tracker] trackingId loaded: UA- 54498004-1
09-23 16:26:57.775: V/GAV4(7763): Thread[main,5,main]: [Tracker] sample frequency loaded: 99.8
09-23 16:26:57.775: V/GAV4(7763): Thread[main,5,main]: [Tracker] session timeout loaded: 2000000
09-23 16:26:57.775: V/GAV4(7763): Thread[main,5,main]: [Tracker] auto activity tracking loaded: true
09-23 16:26:57.775: V/GAV4(7763): Thread[client_id_fetcher,5,main]: Loaded client id from disk.
09-23 16:26:57.775: V/GAV4(7763): Thread[main,5,main]: [Tracker] anonymize ip loaded: true
09-23 16:26:57.775: V/GAV4(7763): Thread[main,5,main]: [Tracker] anonymize ip loaded: false
09-23 16:26:57.785: V/GAV4(7763): Thread[main,5,main]: ExceptionReporter created, original handler is com.android.internal.os.RuntimeInit$UncaughtHandler
09-23 16:26:57.785: V/GAV4(7763): Thread[main,5,main]: Uncaught exceptions will be reported to Google Analytics.
09-23 16:27:02.895: V/GAV4(7763): Thread[GAThread,5,main]: connecting to Analytics service
09-23 16:27:02.985: V/GAV4(7763): Thread[main,5,main]: service connected, binder: android.os.BinderProxy@41ae4840
09-23 16:27:02.985: V/GAV4(7763): Thread[main,5,main]: bound to service
09-23 16:27:03.015: V/GAV4(7763): Thread[GAThread,5,main]: connect: bindService returned true for Intent { act=com.google.android.gms.analytics.service.START cmp=com.google.android.gms/.analytics.service.AnalyticsService (has extras) }
09-23 16:27:03.055: V/GAV4(7763): Thread[main,5,main]: Connected to service
09-23 16:27:03.445: I/GAV4(7763): Thread[GAThread,5,main]: No campaign data found.
09-23 16:27:03.445: V/GAV4(7763): Thread[GAThread,5,main]: Initialized GA Thread
-after some time"
09-23 16:32:04.910: V/GAV4(7763): Thread[disconnect check,5,main]: Disconnecting due to inactivity
09-23 16:32:04.920: V/GAV4(7763): Thread[disconnect check,5,main]: Disconnected from service
But the issue is that it is not giving uncaught crash and exception. I manually making eception and after exception I get the following logs as:
09-23 16:32:22.770: V/GAV4(7763): Thread[main,5,main]: Tracking Exception: ActivityNotFoundException (@FullVideoActivity:onCompletion:276) {main}
09-23 16:32:22.770: V/GAV4(7763): Thread[main,5,main]: Dispatch call queued. Dispatch will run once initialization is complete.
09-23 16:32:22.770: V/GAV4(7763): Thread[main,5,main]: Passing exception to original handler.
I am not getting any exception and crash on google analytics account. Can anyone help me to solve this problem?
Thanks Ishan jain