java - Blackberry Bold 9000 Internet Connection works fine and then breaks -
i've read lot posts on web, haven't found solution.
i've developed blackberry app ( sdk 5 ) that's using httpconnection get/set data server.
i tried connect via wireless , g2/g3 connection.
in both cases application works fine time , internet connection breaks (sometimes in middle of loading data server). after happens application doesn't work , can't go web page (in bb browser). looks bb disables internet.
when try in bb browser following message:
unable connect internet please try again later. if problem persists please contact service provider
the way internet go settings , disable wifi , re-enable again. after works, again time.
it never breaks @ same point.
here code i'm using data server:
string urlpath = "http://www.mysite.com/api/?debug=true"; //debug variable on site, it's not necessary if(deviceinfo.issimulator()){ urlpath += ";deviceside=true"; } else { if (wlaninfo.getwlanstate() == wlaninfo.wlan_state_connected) { urlpath += ";interface=wifi"; }else{ urlpath += ";deviceside=true"; } } httpconnection httpconn = (httpconnection) connector.open( urlpath ); httpconn.setrequestmethod(httpconnection.post); httpconn.setrequestproperty("content-type", "application/x-www-form-urlencoded"); httpconn.setrequestproperty("user-agent", "profile/midp-2.0 configuration/cldc-1.0"); httpconn.setrequestproperty("content-language", "en-us"); httpconn.setrequestproperty("connection", "close"); outputstream os = httpconn.openoutputstream(); os.write(temp1.getbytes()); os.flush(); os.close(); stringbuffer sb = new stringbuffer(); datainputstream = httpconn.opendatainputstream(); int chr; while ((chr = is.read()) != -1) { sb.append((char) chr); } string response = new string(sb.tostring().getbytes(), "utf-8"); what doing wrong?
is there way fix , keep connection stable , responsive?
thanks.
Comments
Post a Comment