Android Google Analytics does not report opt-out or exception

I am creating an application where I want to see a crash and exception report in Google Analytics account.

I am using the following code for this function:

"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 my manifest file like this:

<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 my application class, I used this code like this:

Tracker tracker = GoogleAnalytics.getInstance(this).(R.xml.analytics_track);

      

I am running login as an application:

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

      

- over 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 problem is that it does not give uncaught crash and exception. I manually throw an eception and after the 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 exceptions or crashes in my Google Analytics account. Can anyone help me solve this problem?

Thank you Ishan Jain

+3


source to share


1 answer


You are not submitting a hit to the service. You should get after Thread [GAThread, 5, main]: Initialized GA Thread:

    Thread[GAThread,5,main]: Loaded clientId
    Thread[GAThread,5,main]: putHit called
    Thread[GAThread,5,main]: Sending hit to service ..

      

In your application class, you should use:



 Tracker tracker = GoogleAnalytics.getInstance(this).newTracker(R.xml.analytics_track);

      

If it doesn't work yet, you can also try to install GoogleAnalytics by adding the following class to onCreate () from your application class:

private void initGoogleAnalytics() {
    GoogleAnalytics mGoogleAnalytics = GoogleAnalytics.getInstance(this);
    mGoogleAnalytics.setDryRun(false);
    mGoogleAnalytics.setLocalDispatchPeriod(10);
    mGoogleAnalytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE);
    mGoogleAnalytics.enableAutoActivityReports(this);
}

      

0


source







All Articles