Hello, 

If you insist on modifying the expiry timeout, try to 
setProperty<http://developer.android.com/reference/java/lang/System.html#setProperty(java.lang.String,
 
java.lang.String)>("android.telephony.apn-restore", *timeout* *ms*). It 
will override the default recovery time.

Meanwhile, solution provided by Sascha works well for your connection to be 
a workaround.

BRs,
Zerg

On Friday, June 1, 2012 4:30:40 PM UTC+8, Sascha wrote:
>
> Hello,
>
> I think there is no way to change the expiry timeout itself.
>
> However, you can reset the expiry event by calling
>
> connMan.startUsingNetworkFeature(ConnectivityManager.TYPE_MOBILE, 
> "enableHIPRI");
>
> repeatedly every 30 seconds or so.
>
> This should stabilize your connection as long as you need it.
>
> Hope this helps
> Sascha
>
>
> Am Donnerstag, 1. März 2012 02:55:50 UTC+1 schrieb flumby:
>>
>> In my project, I need to access an IP Address through mobile connection 
>> --irrespective of whether it is connected to mobile or WIFI network. My 
>> code is similar to below:
>>
>>
>>                connMan = (ConnectivityManager) 
>> getSystemService(Context.CONNECTIVITY_SERVICE);
>>                int res = 
>> connMan.startUsingNetworkFeature(ConnectivityManager.TYPE_MOBILE, 
>> "enableHIPRI");
>>
>> Then when I get the notification that HIPRI is available, I call:
>>                boolean reqRes = 
>> connMan.requestRouteToHost(ConnectivityManager.TYPE_MOBILE_HIPRI, 
>> ipAddress);
>>
>> This is working fine. My app can connect to the URL specified in the 
>> ipAddress. My app can send requests, and receive responses. However, the 
>> connection gets disconnected after about a minute. Is there a way to have 
>> HIPRI connection for longer time?
>>
>> To make a short story long,  I see the following in the log:
>> D/ConnectivityService( 1640): ignoring as dup is found 
>> stopUsingNetworkFeature for net 5: enableHIPRI by 9683/10033(expire - 
>> created 60026 mSec ago)
>>
>> I took a look at the source and I see that in ConnectivityService.java, 
>> in the implementation of requestRouteToHost method, it calls:
>>
>>       mHandler.sendMessageDelayed (mHandler.obtainMessage 
>> (NetworkStateTracker.EVENT_RESTORE_DEFAULT_NETWORK, f), 
>> getRestoreDefaultNetworkDelay());
>>
>> And I see that getRestoreDefaultNetworkDelay is returning 60000. So, I 
>> know why my app is getting disconnected after about a minute.
>> My question is, how can I have HIPRI connection for a longer period -at 
>> least 30 minutes?
>>
>

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

Reply via email to