BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 06-23-2008, 11:23 PM   #1
skynetchris
Knows Where the Search Button Is
 
Join Date: Apr 2008
Model: 7100T
PIN: N/A
Carrier: optus
Posts: 24
Default Battery - HTTP connection lost problem.

Please Login to Remove!

I have a connection running in a thread that sends data back via a http connection. When the battery is in critical and radio is turned off, the connection is lost. This issue has been discussed before.

The thread contains the http connection as follows:

Code:
StreamConnection connection = (StreamConnection)Connector.open(rawUrl);
HttpConnection httpConn = (HttpConnection)connection;
The problem of auto-establishing the connection again seems to be more difficult than I first thought. I assumed I could just stop the thread gracefully (does this remove the instance of the thread? I assume so).

Code:
if (stop){
   return;
}
This all goes fine in the simulator, the thread stop and then re-starts (due to a programatic check on battery & when data needs to be sent).

Code:
if (sendThread != null)
{
   if (!sendThread.isAlive())
   {
      sendThread = new SendThread(url);
      sendThread.start();
    }
 }
 else
 {
    sendThread = new SendThread(url);
    sendThread.start();
 }
However, because radio is also switched off when in critical battery, and NOT automatically turned back on when it returns to 'good', the connection never takes place.

So my question is, how would you programattically check and re-establish GPRS/http connection. Would it be via the Radio class in the BB API? Do you think this will resolve the issue?

I was thinking something like:

Code:
if (GPRSInfo.getGPRSState() == GPRSInfo.GPRS_STATE_IDLE)
{
   Radio.activateWAFs(someIntegerHere);
}
Anyone else come across and solved this?

Last edited by skynetchris; 06-23-2008 at 11:26 PM..
Offline  
Old 06-24-2008, 12:38 AM   #2
shraddha294
Thumbs Must Hurt
 
shraddha294's Avatar
 
Join Date: Oct 2007
Location: Hyderabad
Model: 8800
PIN: N/A
Carrier: TMobile
Posts: 111
Default

I faced this issue... the battery getting good didn't turn on radio and didnt get any API to turn on radio. I couldn't find anyway to switch on the radio programatically. Either a device restart or manual turning on of radio was needed.

We just prompt user to switch on radio to proceed with app...
Offline  
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


CBB60 Motor Run Capacitor 450VAC 10uF/20uF/30uF/40uF/50uF 4 Pins CE Standard picture

CBB60 Motor Run Capacitor 450VAC 10uF/20uF/30uF/40uF/50uF 4 Pins CE Standard

$12.99



BEEYUIHF 625Pcs 24Values Aluminum Electrolytic Capacitor Kit 10V-100V 1F-1000uF picture

BEEYUIHF 625Pcs 24Values Aluminum Electrolytic Capacitor Kit 10V-100V 1F-1000uF

$24.99



45/5 MFD uf Round Dual Run Capacitor HVAC AC 45+5 µF 370-440VAC 50/60Hz 5% picture

45/5 MFD uf Round Dual Run Capacitor HVAC AC 45+5 µF 370-440VAC 50/60Hz 5%

$20.99



1PCS - C61 4.5uF+5uF+6uF 5 WIRE 250VAC Ceiling Fan Capacitor UL CERTIFIED picture

1PCS - C61 4.5uF+5uF+6uF 5 WIRE 250VAC Ceiling Fan Capacitor UL CERTIFIED

$7.50



CBB61 250V  Capacitor 2 wires 1/2/3/3.5/4/5/6/7/8/9/10/12/15/18/20/24/25/30 UF picture

CBB61 250V Capacitor 2 wires 1/2/3/3.5/4/5/6/7/8/9/10/12/15/18/20/24/25/30 UF

$129.95



6.3V 10V 16V 25V 35V 50V 100V 400V SMD Aluminum Electrolytic Capacitor 1-1000 UF picture

6.3V 10V 16V 25V 35V 50V 100V 400V SMD Aluminum Electrolytic Capacitor 1-1000 UF

$155.59







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.