I've implemented Google Analytics (V2) into my Android app. A while ago the code managed to send data to the profile (V2) succesfully. However now it refuses to connect to the service:
04-09 14:42:49.911: W/GAV2(8576): Thread[main,5,main]: Need to call initialize() and be in fallback mode to start dispatch.
04-09 14:42:49.921: I/GAV2(8576): Thread[main,5,main]: ExceptionReporter created, original handler is com.android.internal.os.RuntimeInit$UncaughtHandler
04-09 14:42:50.051: D/libEGL(8576): loaded /system/lib/egl/libEGL_mali.so
04-09 14:42:50.061: D/libEGL(8576): loaded /system/lib/egl/libGLESv1_CM_mali.so
04-09 14:42:50.061: D/libEGL(8576): loaded /system/lib/egl/libGLESv2_mali.so
04-09 14:42:50.120: D/OpenGLRenderer(8576): Enabling debug mode 0
04-09 14:42:50.190: W/IInputConnectionWrapper(8576): showStatusIcon on inactive InputConnection
04-09 14:42:54.881: I/GAV2(8576): Thread[GAThread,5,main]: connecting to Analytics service
04-09 14:42:54.891: I/GAV2(8576): Thread[GAThread,5,main]: connect: bindService returned false for Intent { act=com.google.android.gms.analytics.service.START (has extras) }
04-09 14:42:54.901: W/GAV2(8576): Thread[GAThread,5,main]: Service unavailable (code=1), will retry.
04-09 14:42:54.941: I/GAV2(8576): Thread[GAThread,5,main]: No campaign data found.
04-09 14:42:59.911: I/GAV2(8576): Thread[Service Reconnect,5,main]: connecting to Analytics service
04-09 14:42:59.921: I/GAV2(8576): Thread[Service Reconnect,5,main]: connect: bindService returned false for Intent { act=com.google.android.gms.analytics.service.START (has extras) }
04-09 14:42:59.921: W/GAV2(8576): Thread[Service Reconnect,5,main]: Service unavailable (code=1), using local store.
04-09 14:42:59.921: I/GAV2(8576): Thread[Service Reconnect,5,main]: falling back to local store
04-09 14:42:59.971: V/GAV2(8576): Thread[GAThread,5,main]: dispatch running...
04-09 14:43:00.061: V/GAV2(8576): Thread[GAThread,5,main]: ...nothing to dispatch
04-09 14:43:00.061: I/GAV2(8576): Thread[GAThread,5,main]: PowerSaveMode initiated.
04-09 14:43:52.951: D/dalvikvm(8576): GC_CONCURRENT freed 197K, 4% free 7258K/7492K, paused 15ms+5ms, total 56ms
04-09 14:43:54.611: W/IInputConnectionWrapper(8576): showStatusIcon on inactive InputConnection
I'm pretty sure my code is sufficient since it managed to send data before. These are the steps I implemented (used the Android Google Analytics V2 docs):
manifest additions:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
main activity additions:
@Override
public void onStart() {
super.onStart();
EasyTracker.getInstance().activityStart(this);
}
@Override
public void onStop() {
EasyTracker.getInstance().activityStop(this);
super.onStop();
}
xml (analytics.xml)
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<!--tracking ID-->
<string name="ga_trackingId">UA-(copied from profile)-1</string>
<!--Enable automatic activity tracking-->
<bool name="ga_autoActivityTracking">true</bool>
<!--Enable automatic exception tracking-->
<bool name="ga_reportUncaughtExceptions">true</bool>
<!--Enable debug tracking-->
<bool name="ga_debug">true</bool>
<integer name="ga_dispatchPeriod">20</integer>
</resources>
I get the warnings at the very launch of the app. I've tried creating a new profile/account. I've tried using & #45; and & #8211; instead of the dashes. It's been 30+ hours since last data was received on the profile, since then the above logcat lines.
Any ideas how this is caused?
Another reason why your Google Analytics is not working is that it might be conflicting with another script on your webpage. If you have other scripts running on your website, make sure they don't use the same variables as Google Analytics.
You can record activity on different screens by swiping left and right. Go to Analytics and select the Analytics account you registered the app with. If you're unsure, look for the Analytics tracking ID in the google-services. json file you added to your project earlier.
To see if Google Analytics is firing on your page, go to any page on your site in your Chrome Browser and right-click. Click on Inspect. Then go to the Network tab. Hit refresh on your browser and watch to see the different content and scripts loading on the page.
Might not to be your case but here it goes anyways.
I had analytics working fine in my app. I was using Eclipse and decided to switch to Intellij IDE. When I did it, the IDE showed me a typografic warning on the dash character of my analytics.xml file (regarding ga_trackingId). When I made the change (invisible to the human eye) the warning went away but analytics just stopped working.
Might be something with the encoding of the file, whatever, but I my case I had to type the dash character and not paste it (and also add a tools:ignore="TypographyDashes" in my file to get rid of the warning).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With