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.

code:.................

Android :: HttpsUrlConnection Problem


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:

CODE:.................

But I get an Exception:

CODE:......................

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

View 2 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:

CODE:....................

View 3 Replies View Related

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:

CODE:...............

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:

CODE:.............

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

View 2 Replies View Related

Android :: HttpsURLConnection Failing Intermittently To Same URL

May 15, 2010

I think I'm experiencing the same as http://groups.google.com/group/android-developers/msg/9d37d64aad0ee357

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?

CODE:............................

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.

CODE:..................

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:

CODE:........................

View 3 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:

code:..............

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.

code:..............

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 http://groups.google.com/group/android-developers/msg/9d37d64aad0ee357

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?

CODE:.........................

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. ;)

CODE:.......................

View 1 Replies View Related

Android :: Android How To Send Data From Server To Android With No Request From Android?

Oct 19, 2010

today i meet the problem.i need technic can control the android machine from server.then i want send data from server to android with no request from android.

View 2 Replies View Related

Android :: Android 1.6 - Android - View - WindowManager$BadTokenException - Unable To Add Window - Token Null Is Not For An Application

Apr 14, 2010

I'm trying to open a dialog window, but every time I try to open it it throws this exception:

CODE:.................

I'm creating it by calling showDialog with the display's id. The onCreateDialog handler logs fine and I can step through it without an issue, but I've attached it since it seems like I'm missing something:

CODE:............

Is there something missing from this? Some questions have talked about having this problem when creating a dialog from onCreate, which happen because the activity isn't created yet, but this is coming from a call from a menu object, and the appContext variable seems like it is correctly populated in the debugger.

View 3 Replies View Related

Android :: Android WebView Not Loading A JavaScript File But Android Browser Loads It Fine

Jun 3, 2010

I'm writing an application which connects to a back office site. The backoffice site contains a whole slew of JavaScript functions, at least 100 times the average site. Unfortunately it does not load them, and causes much of the functionality to not work properly. So I am running a test. I put a page out on my server which loads the FireBugLite javascript text. Its a lot of javascript and perfect to test and see if the Android WebView will load it. The WebView loads nothing, but the browser loads the Firebug Icon. What on earth would make the difference, why can it run in the browser and not in my WebView? Any suggestions.
More background information, in order to get the stinking backoffice application available on a Droid (or any other platform except windows) I needed to trick the bakcoffice application to believe what's accessing the website is Internet Explorer. I do this by modifying the WebView User Agent.Also for this application I've slimmed my landing page, so I could give you the source to offer me aid. package ksc.myKMB;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.Window;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebSettings;
import android.webkit.WebViewClient;
import android.widget.Toast;
public class myKMB extends Activity {
I already have JavaScript on the web browser on, the problem is the web view is acting to different from the web browser.

View 1 Replies View Related

Android :: Resolve The Error - Com.android Internal R Cannot Be Resolved - Using Android File MultiAutoCompleteTextView.java

Aug 15, 2010

I want to implement my own Tokenizer base on the file
"MultiAutoCompleteTextView.java",

but I encounter an error "com.android.internal.R cannot be resolved" when I try to

import "MultiAutoCompleteTextView.java" to my project.

code:.................

I haven't research any solutions to resolve this problem.How to correct "com.android.internal.R.attr.autoCompleteTextViewStyle" my own attr?

View 1 Replies View Related

Android :: Does Android Eclair Code Base Support Plugins In Android Browser?

Jan 11, 2010

1- Does Android Browser (Éclair code base) support the "plug-in" or not?

2- Why "Google Gears" support is removed from the clair code base?

I searched the forum and came to know that earlier version of the Android does not support it at all? Here is the link for that, but this query asked in Dec'2008.

View 2 Replies View Related

Android :: Android How To Edit Specific Record From Database In Android Programming

Jan 5, 2010

At first,I have a database created by using Ruby on rails.I just already implement insert function(HTTPPost) in my Android Application and it's work.But I don't know how to retrieve specific record from my databases and insert it back to specific record in Android (Like edit function in RoR)This is my insert code :
private void insertComment() {DefaultHttpClient client = new DefaultHttpClient();HttpPost post = new HttpPost("http://10.10.3.87:3000/comments");
// Configure the form parameters
List<NameValuePair> nvps = new ArrayList<NameValuePair>();
nvps.add(new BasicNameValuePair("comment[content]", t_comment.getText().toString();
nvps.add(new BasicNameValuePair("comment[id_account]", "1"));
nvps.add(new BasicNameValuePair("comment[id_place]", Integer.toString(position)I really try many ways out but it doesn't work and it takes very long time to fight with this piece of code. Actually, I really don't know how to specify RowID to HTTPPost.

View 2 Replies View Related

Android :: Android.. How To Upload Data From Android Phone To Remote Database?

Sep 17, 2010

I am doing some android development, and now I need to send some android application generated data onto a remote server (a database)?How can I do that? can I use direct JDBC connection and sql?

View 1 Replies View Related

Android :: Sending Info From Android Phone To An Computer IP With Android Emulator

Oct 9, 2010

So i am making a android app, and i want it to be so if i call lets say 911 it sends my GPS coordinents to a certain IP, i know everything but how i make it so if i call 911 it sends the info and how i can make it send the info to the IP via 3g,

View 3 Replies View Related

Android :: Android Market Hiding Apps With Bluetooth Permissions From Android 1.5 And 1.6

Jul 10, 2010

I released updates of my apps yesterday and they are being hidden from android 1.5 and 1.6 phones.

This is due to a Market bug which hides apps with bluetooth permissions from android 1.5 and 1.6.

Come on Google fix the market. We spend countless hours making are apps work on ALL android versions and now you do this...

This issue has been raised since June, but has only affected me since i made an update to the market yesterday.

View 1 Replies View Related

Android :: Mock And Performance Tests Available In Android For Testing Android Application

Dec 23, 2009

What exactly are mock tests... I need to know the mock and performance tests available in android for testing android apps..what is the best tool for testing android apps and how..

View 1 Replies View Related

Android :: Android - Add Menu Item To Android's Built-in Apps

Aug 17, 2009

I'd like to add a menu option to the Android camera app. Is this possible to do using the current SDK? I know I need to add an intent-filter tag in my activity. But I don't know what I should put in the mime type. I want to be able to process the live camera previews if the user selects the menu option. So what do I put into the type tag of the intent-filter? Also I suppose I won't be using ALTERNATIVE or SELECTED-ALTERNATIVE for the category as I want to deal with the whole intent?

View 3 Replies View Related

Android :: Does The Android Market Check Installed Android's Version ?

Jan 21, 2010

I was wondering if the market checks if the application can be installed on the device. For example, if I have an Android 1.6 and if I try to install an application with :"<uses-sdk android:minSdkVersion="7" />" on its manifest. What will happend ?

View 4 Replies View Related

Android :: Android IRC Office Hours - Android Bluetooth RSSI

Jan 27, 2010

I have a question about bluetooth RSSI functionality on the Android (either 2.0 or 2.1):

It's easy enough to get the RSSI value when a bluetooth connection is created, but how can you repeatedly get the RSSI value of a connection that is already active? It's really important to be able to do this, because this lets you determine if bluetooth devices are close to each other or far away, but I can't find any appropriate function calls in the Android API.

View 2 Replies View Related

Android :: Moto Android Stuck On Android Splash Screen

Feb 5, 2010

I am having a bit of a problem with my Android. So what happened was I downloaded "DroidRootPro" from the market. I rooted my phone with this, installed the 800MHZ ROM image, rebooted and the phone came up great. I was actually surprised on how fast it became. Once the phone came back up, I tried installing one of the custom themes that came with that app (I know I should have left it alone). The phone than rebooted and I was never able to bring it back up. It gets stuck in this endless loop where it tries to boot but doesn�t get past the "Droid" splash screen, it just keeps rebooting every time.

Things I have tried:

-Wipe data/factory reset (in recovery mode), no go.
-Wipe cach partition, no go
-Restore from a "nandroid" backup, no go. I tried pretty much every combination of restores and am unable to bring the phone up.

Is there anyway I can download the factory image that comes with the phone, put it on an SD card and restore to that? I have looked all over but cant find any information on this.

View 1 Replies View Related

Android :: How To Reference R.java Of Other Apps In Android - Like Com.android.music

Sep 29, 2010

I am trying to develop an app to supplement the built-in music player. I've used git to download the com.android.music package and looked around at its code. I can launch the music player by copying some of its code and launching activities with intents.

Now what I need to do is get a handle to its current view. In the MusicUtils.java file, I see a line that says

View nowPlayingView = a.findViewById(R.id.nowplaying);

I'd like to do the same thing. Only I don't have access to the R.java file, so I can't write e.g. R.id.nowplaying. How do I do this? How do I reference the music players R.java? I do know the R.java stuff is declared public so that shouldn't be a problem. Right?

Is it even possible? I saw this related question and am now wondering: http://stackoverflow.com/questions/2437271/how-to-load-com-android-music-code-into-eclipse-and-compile

I'm working against the Android 2.2 SDK, but it'd be helpful to know if the answer is different for older versions such as 1.5.

View 2 Replies View Related

Android :: How To Write Android.mk For An Application Using Com.google.android.maps.jar

Aug 26, 2010

I am developing an application using com.google.android.maps.jar It is OK to develop it with Eclipse SDK. but an build-error happens when building system.img with GMS licence (com.google.android.maps.jar is already installed at out/target/common/ obj/JAVA_LIBRARIES/com.google.android.maps.jar_intermediates/ com.google.android.maps.jar)

make: *** No rule to make target `out/target/common/obj/JAVA_LIBRARIES/ com.google.android.maps.jar_intermediates/javalib.jar', needed by `out/ target/common/obj/APPS/LifeStory_intermediates/classes-full- debug.jar'. Stop.

Here is my Android.mk

CODE:.............

View 4 Replies View Related

Android :: Android AsyncTask Testing With Android Test Framework

Feb 23, 2010

I have a very simple AsyncTask implementation example and have problem to test it using Android JUnit framework. It works just fine when I instantiate and execute it in normal application. However when it's executed from any of Android Testing framework classes (i.e. AndroidTestCase, ActivityUnitTestCase, ActivityInstrumentationTestCase2 etc) it behaves sarngely:

- It executes doInBackground() method correctly
- However it doesn't invokes any of its notification methods (onPostExecute(), onProgressUpdate(), etc) --
just silently ignores them whitout showing any errors. This is very simple AsyncTask example................................

View 2 Replies View Related

Android :: Android WiFi With Out An Android Mobile Data Plan

Nov 26, 2010

I was woundering if i bought a Cell Phone with out a Data Plan that had Android WiFi that i could still access the Android Network when I was in a WiFi area?Is Android WiFi Apps the same as Android Mobile Apps?

View 13 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved