Milos Cuculovic
Milos Cuculovic

Reputation: 20223

Android and Google Analytics: Cant track events

I am using google analytics in my projec and I am getting the "Problem with socket or streams." error message.

W/GoogleAnalyticsTracker(416): Problem with socket or streams.
W/GoogleAnalyticsTracker(416): java.net.SocketException: Host is unresolved: www.google-analytics.com
W/GoogleAnalyticsTracker(416):  at java.net.Socket.connect(Socket.java:966)
W/GoogleAnalyticsTracker(416):  at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:119)
W/GoogleAnalyticsTracker(416):  at com.google.android.apps.analytics.PipelinedRequester.maybeOpenConnection(Unknown Source)
W/GoogleAnalyticsTracker(416):  at com.google.android.apps.analytics.PipelinedRequester.addRequest(Unknown Source)
W/GoogleAnalyticsTracker(416):  at com.google.android.apps.analytics.NetworkDispatcher$DispatcherThread$AsyncDispatchTask.dispatchSomePendingHits(Unknown Source)
W/GoogleAnalyticsTracker(416):  at com.google.android.apps.analytics.NetworkDispatcher$DispatcherThread$AsyncDispatchTask.run(Unknown Source)
W/GoogleAnalyticsTracker(416):  at android.os.Handler.handleCallback(Handler.java:587)
W/GoogleAnalyticsTracker(416):  at android.os.Handler.dispatchMessage(Handler.java:92)
W/GoogleAnalyticsTracker(416):  at android.os.Looper.loop(Looper.java:123)
W/GoogleAnalyticsTracker(416):  at android.os.HandlerThread.run(HandlerThread.java:60)

Do you have any experience with this?

Thank you.

EDIT:

Here is the code I am using:

GoogleAnalyticsTracker tracker;
tracker = GoogleAnalyticsTracker.getInstance();
tracker.startNewSession("xxxxxxxxxxxxx",context);
tracker.trackPageView("/HomeScreen");
tracker.dispatch();

Upvotes: 0

Views: 449

Answers (1)

Milos Cuculovic
Milos Cuculovic

Reputation: 20223

The problem was in my custom rom. In some custom ROMs, in order to increase the battery life, the developpers are changing the localhost ip address. With this change, some services ie. Google Analytics are disabled and no data are uploaded automaticaly. As we know, more than 90% of the apps are using Google Analytics, so this will do the job: prevent data transfer and increase the battery life.

Upvotes: 2

Related Questions