Hi Fred,

Thanks for the feedback. I'm currently implementing something like that, by
sending a heartbeat every 5 minutes (so far the safest interval on tested
devices). But this is not an optimal solution, as the data transfer plan is
a very tight one (particularly those including roaming). That's why our
agreement with the network operator allows idle connections at least for 30
minutes. Sending a heartbeat every 30 minutes is way better than every 5,
because even though the heartbeat is only one byte long, TCP overhead adds
another 66. That's at least 67 bytes every 5 minutes, at least 8h a day.

Cheers.

On 14 December 2012 15:10, Fred Niggle <fred.nig...@googlemail.com> wrote:

> Hi,
> I also experienced this problem, and found the solution was to use a timer
> to send a character to the server every few seconds when idle.
>
> I was lucky that i was also writing the server code sp i could work around
> this.
> Im not sure if this solves the problem your having, but just thought id
> let you know of *a* solution.
>
> Im flagging this in case i learn something new :)
>
> regards,
> Fred
>
>
> On 14 December 2012 10:24, Goncalo Oliveira <gonc...@minkan.net> wrote:
>
>> Hi all,
>>
>> Seems that Android is dropping idle sockets when under a mobile network.
>> Usually, no socket is kept alive for more than 7 minutes of inactivity. I
>> am using a SIM card with a particular APN, that allows idle sockets for at
>> least 30 minutes - this was tested using another kind of device, also
>> communicating with GSM, and there are no drops, so problem isn't the SIM
>> card.
>>
>> After a few searches in the web, I tried a few approaches to work around
>> this, but until now, no success. I tried using a partial wake lock after
>> connecting, releasing only when disconnected - didn't work. Also tried
>> using only a 2G network, as some said that changing from network type could
>> impact on this - same outcome.
>>
>> After digging a bit more and by analyzing logcat, I watched that a 
>> CONNECTIVITY_CHANGE
>> is sent after some idle time, disabling the data transfer availability
>> (active network is mobile, no connectivity) and another one is sent
>> enabling it again (active network is mobile, connectivity). This cuts off
>> all live socket connections.
>>
>> Investigating a little bit more, I also observed that this behavior is
>> not consistent through all Android versions, or maybe (even worse) through
>> different hardware. Connectivity break is occurring in a Galaxy Tab 7
>> with Android 4.0.4. The same isn't occurring in an Unitech TB 100 with
>> Android 3.2.
>>
>> Does anyone know where I can get more information and/or I can work
>> around this? I would really like to avoid sending heartbeats every 6/7
>> minutes.
>>
>>
>> Cheers
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to android-developers@googlegroups.com
>> To unsubscribe from this group, send email to
>> android-developers+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>
>
>
>
> --
> Ubuntu Speech 
> input<https://play.google.com/store/apps/details?id=com.nds.ubuntuspeechinput>is
>  now available on Google Play, along with Magnetic
> Door Alarm 
> app<https://play.google.com/store/apps/details?id=com.nds.magneticdooralarm>
> .
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Gonçalo Oliveira

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to