Android :: HttpsURLConnection And Intermittent Connections

Jan 31, 2010

I'm hoping someone could help me out with intermittent connections I'm getting using code with HttpsURLConnection.

The code I'm using is below:


The connection works the first time everytime when I use it to pull a json file. However, when I use the connection again to send a command, it always fails the first time. It then typically works if I send the
command quickly ( within 5 seconds), but fails if I wait a while. I don't think its a SSL issue because it connects the first time correctly, but I could be wrong here. I also tried many different
variations such as adding:


However, I had no luck. Any help would be greatly appreciated.

Android :: HttpsURLConnection and intermittent connections

General :: Android 4.4 - WiFi Is Intermittent / Buffering / Dropping Connections On Nexus Devices

Jan 6, 2014

I've recently upgraded my Nexus 4, Nexus 7 and Nexus 10 all to Android 4.4 and as soon as I upgraded my Wi-Fi has been awful.The Wi-Fi is incredibly unstable, steaming media has major buffering / intermittency issues, messages sent over instant messaging apps are sometimes instant and sometimes take 30+ seconds to send.

Skype is the most telling of the issues as it randomly loses connection and my notifications literally never come through..Router Wi-Fi Settings: I've tried Channels, 1, 2, 4, 6, 8, 10 and 11

I've also tried adding

to the WCNSS_qcom_cfg.ini file as found:URL>...Wi-Fi is Always On, Wi-Fi Frequency is Auto or 2.4, Wi-Fi Optimization is Off.The wireless / wifi works fine on other tablets, laptops and wireless devices just my nexus devices on 4.4

View 5 Replies View Related

Android :: HttpsUrlConnection Problem

May 20, 2009

I have been working with the HttpsUrlConnection class and have found an interesting issue, it seems to fail on every other connection. The first request connects to the server successfully but the second one always fails. Any ideas on what i may be doing wrong.

Here is my code.


View 3 Replies View Related

Android :: Problem With HttpsURLConnection

Sep 17, 2010

I use the following code snippet to connect to a server and retrieve some data:

HttpsURLConnection con = (HttpsURLConnection)myurl.openConnection(); InputStream ins = con.getInputStream();

The code mostly works fine. If I leave the app for a few minutes, and return to it and make another request, I receive an IOException: Broken Pipe.

Once it has failed one time, it immediately works again, and will continue to do so until I leave it for a while once more.

I don't know if this is an Android specific thing, or general Java, but it doesn't happen on my desktop test version.

View 7 Replies View Related

Android :: ClassCastException With HttpsURLConnection

Aug 30, 2010

I try to establisch a HttpsURLConnection with:


But I get an Exception:


But I can't find out, why. The same example is everywhere across the web.

View 2 Replies View Related

Android :: Intermittent Service Start

May 15, 2009

We have a service. bindService() returns true. But our ServiceConnection is never called with onConnect(). The onCreate() of the service is never executed (neither is the onBind(), of course).

Except sometimes! (twice now, out of many many tries).

Remote service, local service, intent-filter, direct class invocation, "procedure" attribute, no procedure attribute, cupcake, 1.1, emulator, device ... we've tried 'em all!

We belive the service is found, and in the remote case, we see the new process always created ... but the dang service just isn't started. We aren't specifying any security settings and writing the simplest manifest entry we can....

View 4 Replies View Related

Android :: Query About The Usage Of HttpsURLConnection

Mar 9, 2010

I am using HttpsURLConnection to post data to a web server.

Here is the function I wrote to get the result. (see the code below)

Very strangely, when the function be first called in my program it would very likely return -1; and then I re-call the function after the first call, it would always work ok.

So I wonder if there is anything I am missing in the code that when the function be firstly called, the missing party is be "initialized", in that the followed call goes OK.

Here is my code of the function:


View 3 Replies View Related

Android :: HttpsURLConnection Failing Intermittently To Same URL

May 15, 2010

I think I'm experiencing the same as

This is Android 1.5 SDK. I happen to call several times below code(which is in a method) with
the same url and it fails intermittently. When it fails, there is no exception, the stream is empty so the
readConnection fails, and getResponseCode returns -1. Global caching is disabled, setDefaultUseCaches(false);

I suppose there must be some kind of url connection object pool somewhere.

How can I workaround this?


View 2 Replies View Related

Android :: HttpsURLConnection.getInputStream Hangs

Aug 16, 2010

I try to build an https client for android and i need do get some request of an Servlet but when i use the getInputStream method the applicaion hangs.

There is no error only hanging when i call the method.


This is only to check the call, but it didtn work.

the subscribe method works, when i comment out the line with the inputstream, the server show me all is correct. I can try the same with the Firefox and it works and i can see the request. i also put the keystore into the TrustManager.

View 2 Replies View Related

Android :: HttpsURLConnection Connection Problems

Sep 27, 2010

I'm a problem with a HttpsURLConnection that I can't seem to solve. Basically, I'm sending up some info to a server and if some of that data is wrong, the server sends me a 500 response code. However, it also sends a message in the response telling me which bit of data was wrong. The problem is that the message is always empty when I read it in. I think this is because a filenotfound exception always gets thrown before the stream can be read. Am I right? I tried reading the errorstream as well but this is always empty.

Here's a snippet:


View 3 Replies View Related

Android :: Launching ADB LogCat - Getting Intermittent Error

Oct 13, 2009

Since upgrading to the v1.6 SDK, I'm getting an intermittent error when trying to launch the logcat from the command line:
>adb logcat

View 2 Replies View Related

Android :: Sending Huge Files With HttpsUrlConnection

Mar 12, 2010

I have some Android code that can send files to my webserver using an HttpsUrlConnection, but when it tries to send larger files I get an OutOfMemory exception when opening the OutputStream. Can anyone offer some assistance?

It looks something like this:


This is where I try different things. The closes solution has been: httpConn.setChunkedStreamingMode(1024); In this case, I don't get the OutOfMemory immediately when opening the OutputStream, but I see the heap growing as I os.write() and it eventually runs out.


View 7 Replies View Related

Android :: HttpsUrlConnection And OpenSSL Freeing Session

Mar 30, 2010

I've got a problem with my application when I make a number of requests using the HttpsUrlConnection class.

My program makes the first request using the HttpsUrlConnection class to retrieve a file. It then makes a second request to the same server to retrieve a different file. What happens however is that periodically I'm getting a -1 HTTP response code on the connection.

When the failure occurs between the two requests I see the following line of trace in logcat:

D/OpenSSLSessionImpl( 699): Freeing OpenSSL session

This seems to happen fairly consistently. If I retry the second request after it has failed it generally works and I get the requested file from the server.

Note that if I don't see the OpenSSL session being freed the second request works fine the first time.

Some other information:

1) I'm not calling disconnect on the connection

2) I'm don't always read the entire file from the server after the first request

3) I always close the InputStream in the event that I get an InputStream on the first connection

How to prevent the OpenSSL session from being freed.

View 2 Replies View Related

Android :: HttpsURLConnection Returns -1 Code On Second Request

May 15, 2010

I'm experiencing the same as

This is Android 1.5 SDK. I happen to call several times below code(which is in a method) with the same url and it fails intermitently. When it fails, there is no exception, the stream is empty so the readConnection fails, and getResponseCode returns -1. Global caching is disabled, setDefaultUseCaches(false);

How can I workaround this?


View 4 Replies View Related

Android :: Every Second HttpsUrlConnection Request Of My Static Method Fails

Nov 24, 2010

I'm having a big issue with a static HTTPS connection method. Every second request fails and HttpsUrlConnection.getResponseCode() returns -1. So every second call works well, returning data as expected.

It's the method of a static class I'm using in different corners of my application. I would guess there is anything I don't clean up correctly when the method returns the first time and that whatever causes a problem might get destroyed through a second call of the method. But I'm having a hard time finding any clues.

I'm currently using this class to talk to hosts with invalid SSL certificates. Not going to use this in the final version of the app, but right now I need to save money. ;)


View 1 Replies View Related

Sprint HTC Hero :: Intermittent Bluetooth Errors In 2.1.2

Jun 8, 2010

I make a call and it connects but I can't hear them and they can't hear me. It doesn't matter if it is a incoming or an outbound call. Sometimes I have to power down the phone and turn it back on, the call then connects correctly. I'm totally bewildered!!! I have fresh 2.1.2/ a gumbo kernal.Any advice and help is greatly appreciated.

View 19 Replies View Related

HTC EVO 4G :: Intermittent Sound With Modified Boot Animation

Jul 24, 2010

I installed a boot animation per the instructions here ( I left the "Droid" mp3 in the localdata folder, and did not alter the config file. I'm using Pseudoram's boot file from [Collection] Custom Boot Animations and Splash Screens - xda-developers.It plays the sound sometimes, and sometimes not. Anyone know why?

View 3 Replies View Related

HTC Hero :: Unable To Start WiFi - Intermittent Error

Nov 24, 2009

I seem to have an intermittent error when trying to start WiFi. Mostly (>95%) of the time I get "unable to start WiFi". Occasionally it works but this is rare and usually when it has been switched off for a few days. The problem occurs when I try to start via the wi-fi widget or via the MenuSettingsWireless controls path. I'm reluctant to do a factory reset unless I really have no other option.

HTC Hero
on Vodafone UK
Firmware version 1.5
Build# 2.73.405.5

View 2 Replies View Related

Samsung Vibrant :: Intermittent Connection / Errors With WiFi

Sep 25, 2010

I have the same issue with 2 separate Vibrants, actually 3 Vibrants counting the one I took back.I have problems connecting to either the market or internet across multiple browsers while WiFi is on.With both phones, it seems this problem is intermittent and across different brands of routers at different locations.
An example is when I try to enter the market.I sometimes will get to the market home page but when I try to pull up my downloads it comes back with an error message saying connection failed.Once I turn off WiFi it works perfect in 3G, or if I leave WiFi on, go back to the home page and then try just a minute later it connects without a problem.To make matters even worse, the problem persists while using apps that connect to the internet such as The Weather Channel.The problem is very intermittent.Sometimes I have no problems connecting, while other times it won't connect at all until I turn WiFi off or even reboot the phone.Both phones behave the same way.I've gotten to the point now where I just leave WiFi turned off because it's so unreliable.I know it's not the WiFi signal strength either as it is just as likely to happen with the phone a few feet away from the router's antenna as it is when it's 50 feet away.

View 1 Replies View Related

HTC Incredible :: Audio Out Hissing / Intermittent High Pitched That Comes Out Of Speakers

Jun 15, 2010

I'm hoping someone here with some AV knowledge can give me something to try. When I've got my Incredible hooked up to my car stereo via the 3.5mm jack, and have the car charger plugged in, there is a noticeable but intermittent high pitched hiss that comes out of the speakers. If I unplug the car charger it goes away immediately.

I've tried with the volume on the Incredible set at quiet/medium/loud levels and that doesn't seem to make any difference. My guess is that there is resonance from the power cable being picked up by the audio cable, but I've tried moving them around and it doesn't seem to help.

View 7 Replies View Related

General :: Intermittent Loud Scratch Noise During Calls After Cyanogenmod 10 And Generic IMEI?

Nov 24, 2013

I have a Samsung Galaxy S GT-I9000B from Brazil unlocked from the store. Three days ago I decided to update my system (2.2) to the CM10.0.0 (4.1.2). After much sweat and hassle I discovered how do it properly with the right files. So, I flashed 2.3.3 and then CM10 and it seemed to work properly until I found out my IMEI had been corrupted. I tried the solution I found but it didn't work because on step #5 I don't find the file named ".nv_data", just "nv_data.bin.md5". I tried copying just the other but in the end it doesn't change my IMEI back. I still have a generic IMEI but it is not affecting the signal of my phone, I can still make and receive calls, but I would like to get it properly working. When I flash android 2.2 it restores my IMEI.

Problem 2

My other problem is that I keep getting these really loud and intermittent scratch noises during calls after flashing CM10. Right now I am using a dutch SIM for I live in the netherlands. Maybe that is important to mention. But I had been using android 2.2 here all along with no problems. After CM10 I get these sudden short bursts of noise during my calls. The other person can barely hear it but I hear it loudly.

View 6 Replies View Related

Android :: What Are Possible Means Of Connections?

Feb 3, 2010

What kind of connections can we open on Android? Which of the following is possible?
- USB - Serial port - Infrared
I know that Bluetooth is possible, but are the other ones too? And if yes, which classes I have to use?

View 3 Replies View Related

Android :: Maximum Number Of Connections

Jul 29, 2009

I've written an application which involves a lot of simultaneous connections to different servers. I've noticed some big stability issues with this as sometimes the program crashes totally (not just ANR, but a segfault type thing). What's the recommended number of maximum simultaneous connections for speed and stability?

View 11 Replies View Related

Android :: Possible To Have 3G / Wifi Connections At Same Time?

Mar 5, 2010

I was wondering does anyone know if its possible to open a wifi and a 3g connection at the same time on Android? Is there any way to control access to both Wifi and 3g/GPRS data connections and use them at the same time?

View 5 Replies View Related

Android :: Bluetooth Concurrent Connections

Sep 14, 2010

For the buzzer round, I was thinking of writing 2 app for android (we have a few handsets), one for the quiz master and the other for the contestants.The contestants will be connected to the quiz master through bluetooth.After reading the question, the quiz-master clicks a button in his/her app, the button in the contestant apps will be enabled for X seconds. As soon as a contestant clicks his/her button, the quiz master's app will flash the name of that contestant.Is it even possible to have multiple connections and accept concurrent (or multiplexed) messages from them in bluetooth (something similar to select() in unix/c)?If possible, where should I look for any examples? What kind of problems will I face trying to develop this (I know reliability is an issue here) and how to avoid them?

View 2 Replies View Related

Android :: Should Use Services For Network Connections?

Jun 1, 2010

should we use android services for network connection? if yes please provide me a sample.

View 2 Replies View Related

Android :: Network Connections / Access Points

Jul 16, 2010

I have some code that uses a network connection. I create a connection by calling openConnection() on a URL object. Is there any documentation that explains how this process works? Which access point is being used? When that access point becomes invalid, will it automatically switch to another accespoint? etc. I would like to use only WiFi access points and otherwise fail even tho 3G or GPRS could be available, is that possible?

View 7 Replies View Related

Android :: App Design For Multiple Data Connections

Oct 18, 2010

I am working on developing an application that requires me to establish multiple client-server based connections. Connection can be of two types where the Android device can be a server or a client. I can have up to 6 - 8 connections. Once the connections are set-up they need to be running in the background and are not typically affected by UI actions.Since each connection can be blocking, I am wondering what is a good away to design this app. Should I have two services for handling the server and client connections? Each service could have a "connection manager" that can spawn new threads when necessary. Or does creating two services even help? I presume spawning new processed would not be good as they will be expensive. Is this correct? I would appreciate any suggestions. Also, if this use case is not typical please let me know if you need more information to make any recommendation.

View 2 Replies View Related

Android :: How To Use Http Connections Like TCP Socket In Java

Mar 9, 2010

may be asking a bit much here but I have faith in the community so it's worth trying. I'm making a game and I'm trying to pick the connection type to use for communicating between a Java mobile client and a Java server backend.Socket programing in Java is easy - there's a lovely tutorial on the subject and two way communication is trivial.Trouble is that on a mobile client (Android) it's not guaranteed that the cellular network will let you make TCP connections. That makes me think using an HTTP connection is the way to go. HTTP connections are request based but I need a way to push notifications from the server to the client. It seems the solution to this problem is to use 'long polling' I have read a bit about it but have yet to see a simple example for what I'm trying to achieve.Again I might be asking a lot but this seems like a fairly common problem, is there a library or framework I can import / use to wrap a Http connection and provide a two way long standing connection (That reconnects automatically etc). I read a bit about cometD but it doesn't seem to have a Java library that I can just pick up.The communication I need is not heavy, not constant two way streams of data just occasional updates either way to keep the game going.

View 4 Replies View Related

Android :: Package Do I Use To Make HTTP Connections?

Dec 24, 2009

I am trying to make HTTP get & post connections.
Which package is recommended for that?
Is it or org.apache.http?
Does comes included in the sdk?
Any reference/code to connection makin would be appreciable as well.

View 1 Replies View Related

Copyrights 2005-15, All rights reserved