Jon,

I discovered there's an option to switch on debug mode for that Google 
analytics library and then it shows more information what it actually does. 
Thanks to this I found out there's no problem with internet connection 
apparently but there's a problem when it sends more than one hit .

If it sends just one hit it looks like this:

V/GoogleAnalyticsTracker(19436): Called dispatch
V/GoogleAnalyticsTracker(19436): Sending 1 hits to dispatcher
I/GoogleAnalyticsTracker(19436): Host: www.google-analytics.com
I/GoogleAnalyticsTracker(19436): User-Agent: GoogleAnalytics/1.4.2 (Linux; U; 
Android 4.0.4; cs-cz; MT11i Build/4.1.B.0.431)
I/GoogleAnalyticsTracker(19436): GET 
/__utm.gif?utmwv=4.8.1ma&utmn=1930126252&utmt=event&utme=5(Highlights*Get%20all%20highlights*)(0)&utmcs=UTF-8&utmsr=480x854&utmul=cs-CZ&utmac=UA-6572335-10&utmcc=__utma%3D1.1668002474.1339081204.1339081204.1339081352.2%3B&utmht=1339081352153&utmqt=26207
 HTTP/1.1
V/GoogleAnalyticsTracker(19436): HTTP Response Code: 200

... no exception raised.

If it send more than one than it shows this:

V/GoogleAnalyticsTracker(19436): Called dispatch
I/GoogleAnalyticsTracker(19436): Host: www.google-analytics.com
I/GoogleAnalyticsTracker(19436): User-Agent: GoogleAnalytics/1.4.2 (Linux; U; 
Android 4.0.4; cs-cz; MT11i Build/4.1.B.0.431)
I/GoogleAnalyticsTracker(19436): GET 
/__utm.gif?utmwv=4.8.1ma&utmn=1616192853&utmt=event&utme=5(Highlights*Get%20all%20highlights*)(0)&utmcs=UTF-8&utmsr=480x854&utmul=cs-CZ&utmac=UA-6572335-10&utmcc=__utma%3D1.1668002474.1339081204.1339081352.1339081429.3%3B&utmht=1339081429272&utmqt=26689
 HTTP/1.1
V/GoogleAnalyticsTracker(19436): Sending 2 hits to dispatcher
I/GoogleAnalyticsTracker(19436): Host: www.google-analytics.com
I/GoogleAnalyticsTracker(19436): User-Agent: GoogleAnalytics/1.4.2 (Linux; U; 
Android 4.0.4; cs-cz; MT11i Build/4.1.B.0.431)
I/GoogleAnalyticsTracker(19436): GET 
/__utm.gif?utmwv=4.8.1ma&utmn=2117215802&utmt=event&utme=5(Highlights*Map%20-%3E%20show%20highlight*Herkenningspunt%20-%20Grote%20Kerk)(0)&utmcs=UTF-8&utmsr=480x854&utmul=cs-CZ&utmac=UA-6572335-10&utmcc=__utma%3D1.1668002474.1339081204.1339081352.1339081429.3%3B&utmht=1339081452107&utmqt=3894
 HTTP/1.1
V/GoogleAnalyticsTracker(19436): HTTP Response Code: 200
W/GoogleAnalyticsTracker(19436): Problem with socket or streams.
W/GoogleAnalyticsTracker(19436): org.apache.http.NoHttpResponseException: The 
target server failed to respond
W/GoogleAnalyticsTracker(19436):        at 
org.apache.http.impl.io.HttpResponseParser.parseHead(HttpResponseParser.java:73)
W/GoogleAnalyticsTracker(19436):        at 
org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:174)
W/GoogleAnalyticsTracker(19436):        at 
org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:180)
W/GoogleAnalyticsTracker(19436):        at 
com.google.android.apps.analytics.PipelinedRequester.sendRequests(Unknown 
Source)
W/GoogleAnalyticsTracker(19436):        at 
com.google.android.apps.analytics.NetworkDispatcher$DispatcherThread$AsyncDispatchTask.dispatchSomePendingHits(Unknown
 Source)
W/GoogleAnalyticsTracker(19436):        at 
com.google.android.apps.analytics.NetworkDispatcher$DispatcherThread$AsyncDispatchTask.run(Unknown
 Source)
W/GoogleAnalyticsTracker(19436):        at 
android.os.Handler.handleCallback(Handler.java:605)
W/GoogleAnalyticsTracker(19436):        at 
android.os.Handler.dispatchMessage(Handler.java:92)
W/GoogleAnalyticsTracker(19436):        at 
android.os.Looper.loop(Looper.java:137)
W/GoogleAnalyticsTracker(19436):        at 
android.os.HandlerThread.run(HandlerThread.java:60)

... exception raised and as it remembers hits that haven't been send it won't 
send any hit from this time. 

So If I'd called tracker.Dispatch() after every  tracker.TrackEvent(), it'd 
have worked. But for example if there's no connection for a moment, tracker 
won't be able to send the hit and this situation will occur again

Any idea why it behaves like this? I haven't this problem when using this 
library in my original Java application.

Petr

-----Original Message-----
From: monodroid-boun...@lists.ximian.com 
[mailto:monodroid-boun...@lists.ximian.com] On Behalf Of Jonathan Pryor
Sent: 6. června 2012 19:59
To: Discussions related to Mono for Android
Subject: Re: [mono-android] Problem with binding of Google analytics tracker 
library

On Jun 6, 2012, at 11:03 AM, Petr Slováček wrote:
> This is what I get in application output window each time it tries to send 
> the data:

Less useful than I hoped. HttpResponseParser.parseHead():

        
https://github.com/android/platform_external_apache-http/blob/master/src/org/apache/http/impl/io/HttpResponseParser.java#L73

`sesionBuffer` is a SessionInputBuffer (interface), of unknown runtime type, 
and `sessionBuffer.readLine()` returned -1, causing the exception. Grepping 
libGoogleAnalytics.jar, I see no implementations of SessionInputBuffer, so I'll 
assume it's a AbstractSessionInputBuffer:

        
https://github.com/android/platform_external_apache-http/blob/master/src/org/apache/http/impl/io/AbstractSessionInputBuffer.java#L164

This assumption may very well be wrong, but if it's right, the only way for 
readLine() to return -1 is for this.linebuffer.length() to be -1 
(lineFromLinebuffer()), or for fillBuffer() to return -1, which could happen if 
the wrapped InputStream.read() returns end-of-stream.

Either way, I'm not sure why that would be happening, not if your app has the 
INTERNET permission (which iirc you said that your app had). Could you confirm 
that your app has INTERNET permission, e.g. by trying to use WebClient against 
a url?

> I had to add empty IDispatcherCallbacks interface to Additions folder of my 
> java binding library project otherwise it refused to compile.

I'm guessing that this is due to #5143:

        https://bugzilla.xamarin.com/show_bug.cgi?id=5143

 - Jon

_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to