Uploading a file via Android to Dropbox folder - android

I am trying to make users send some app related files to me. I made a "file request" folder in my drop box page for that. Every time i get this message Error 405 - Method not allowed. Here is my code:
private class UploadFile extends AsyncTask<Void, Void, Void> {
#Override
protected Void doInBackground(Void... params) {
try {
String sourceFileUri = "/data/com.mostafa.android.roadbump/databases/matab.db";
HttpURLConnection conn = null;
DataOutputStream dos = null;
String lineEnd = "\r\n";
String twoHyphens = "--";
String boundary = "*****";
int bytesRead, bytesAvailable, bufferSize;
byte[] buffer;
int maxBufferSize = 1 * 1024 * 1024;
if (dB.isFile()) {
try {
String upLoadServerUri = "https://www.dropbox.com/request/KJcdVMDyxHvM2So1mJkK";
// open a URL connection to the Server
FileInputStream fileInputStream = new FileInputStream(dB);
URL url = new URL(upLoadServerUri);
// Open a HTTP connection to the URL
conn = (HttpURLConnection) url.openConnection();
conn.setDoInput(true); // Allow Inputs
conn.setDoOutput(true); // Allow Outputs
conn.setUseCaches(false); // Don't use a Cached Copy
conn.setRequestMethod("PUT");
conn.setRequestProperty("Connection", "Keep-Alive");
conn.setRequestProperty("ENCTYPE", "multipart/form-data");
conn.setRequestProperty("Content-Type", "multipart/form-data;boundary=" + boundary);
conn.setRequestProperty("bill", sourceFileUri);
dos = new DataOutputStream(conn.getOutputStream());
dos.writeBytes(twoHyphens + boundary + lineEnd);
dos.writeBytes("Content-Disposition: form-data; name=\"bill\";filename=\""
+ sourceFileUri + "\"" + lineEnd);
dos.writeBytes(lineEnd);
// create a buffer of maximum size
bytesAvailable = fileInputStream.available();
bufferSize = Math.min(bytesAvailable, maxBufferSize);
buffer = new byte[bufferSize];
// read file and write it into form...
bytesRead = fileInputStream.read(buffer, 0, bufferSize);
while (bytesRead > 0) {
dos.write(buffer, 0, bufferSize);
bytesAvailable = fileInputStream.available();
bufferSize = Math
.min(bytesAvailable, maxBufferSize);
bytesRead = fileInputStream.read(buffer, 0,
bufferSize);
}
// send multipart form data necesssary after file
// data...
dos.writeBytes(lineEnd);
dos.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd);
Log.d("Sasaaa", "Done");
int responseCode = conn.getResponseCode();
String responseMessage = conn.getResponseMessage();
Log.d("Sasaaa", String.valueOf(responseCode));
Log.d("Sasaaa", responseMessage);
// close the streams //
conn.disconnect();
fileInputStream.close();
dos.flush();
dos.close();
} catch (Exception e) {
e.printStackTrace();
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
return null;
}
}

Error 405 - Method not allowed tells me that your request type is not correct. You're trying to execute a PUT request in your server. Please check that again, the server request type might be a POST.
Another thing you need to check is the url or the path you're calling the server method. Incorrect url may result this type of errors.
The last thing you need to check if there's any kind of authentication process before you call the method.
Edit
Dropbox has their own API to upload files to Dropbox server. You might check for them to get this job done easily.
I'm quoting another answer from here for your easy access.
private DropboxAPI<AndroidAuthSession> mDBApi;
File tmpFile = new File(fullPath, "/data/com.mostafa.android.roadbump/databases/matab.db);
FileInputStream fis = new FileInputStream(tmpFile);
try {
DropboxAPI.Entry newEntry = mDBApi.putFileOverwrite("matab.db", fis, tmpFile.length(), null);
} catch (DropboxUnlinkedException e) {
Log.e("DbExampleLog", "User has unlinked.");
} catch (DropboxException e) {
Log.e("DbExampleLog", "Something went wrong while uploading.");
}
You might take a look at here to get idea of API Key and APP SECRET.

Related

Sending Image from Android to RestFul webservice

My Android code is following ,i want to send the image file from Android App to my restful webserivce, code for the Android App and WebService with Error given below
#Override
protected Void doInBackground(Void... params) {
String iFileName = "abc.jpg";
String lineEnd = "\r\n";
String twoHyphens = "--";
String boundary = "*****";
String Tag = "fSnd";
int bytesRead, bytesAvailable, bufferSize;
byte[] buffer;
int maxBufferSize = 1 * 1024 * 1024;
try {
// Log.e(Tag,"Starting Http File Sending to URL");
// Open a HTTP connection to the URL
HttpURLConnection conn = (HttpURLConnection) connectURL.openConnection();
// Allow Inputs
conn.setDoInput(true);
// Allow Outputs
conn.setDoOutput(true);
// Don't use a cached copy.
conn.setUseCaches(false);
// Use a post method.
conn.setRequestMethod("POST");
conn.setRequestProperty("Connection", "Keep-Alive");
conn.setRequestProperty("Content-Type", "multipart/form- data;boundary=" + boundary);
conn.setRequestProperty("file", iFileName);
DataOutputStream dos = new DataOutputStream(conn.getOutputStream());
dos.writeBytes(twoHyphens + boundary + lineEnd);
dos.writeBytes("Content-Disposition: form-data; name=\"file\";file=\""
+ URLEncoder.encode(iFileName, "UTF-8") +"\""+ lineEnd);
dos.writeBytes(lineEnd);
// create a buffer of maximum size
bytesAvailable = fileInputStream.available();
bufferSize = Math.min(bytesAvailable, maxBufferSize);
buffer = new byte[bufferSize];
// read file and write it into form...
bytesRead = fileInputStream.read(buffer, 0, bufferSize);
while (bytesRead > 0) {
dos.write(buffer, 0, bufferSize);
bytesAvailable = fileInputStream.available();
bufferSize = Math.min(bytesAvailable, maxBufferSize);
bytesRead = fileInputStream.read(buffer, 0, bufferSize);
}
dos.writeBytes(lineEnd);
dos.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd);
// close streams
fileInputStream.close();
dos.flush();
// Log.e(Tag,"File Sent, Response: "+String.valueOf(conn.getResponseCode()));
System.out.println("File Sent, Response: "+String.valueOf(conn.getResponseCode()));
InputStream is = conn.getInputStream();
// retrieve the response from server
int ch;
StringBuffer b = new StringBuffer();
while ((ch = is.read()) != -1) {
b.append((char) ch);
}
String s = b.toString();
// Log.i("Response",s);
System.out.println("Response : "+s);
dos.close();
} catch (MalformedURLException ex) {
// Log.e(Tag, "URL error: " + ex.getMessage(), ex);
System.out.println("URL error: " + ex.getMessage());
} catch (IOException ioe) {
// Log.e(Tag, "IO error: " + ioe.getMessage(), ioe);
System.out.println("IO error: " + ioe.getMessage());
}
return null;
}
on the RestFul webservice side i am using following code...
#POST
#Path("/upload")
#Consumes(MediaType.MULTIPART_FORM_DATA)
public Response uploadFile(
#FormDataParam("file") InputStream uploadedInputStream,
#FormDataParam("file") FormDataContentDisposition fileDetail) {
System.out.println("File download starts now");
String uploadedFileLocation = "d://uploaded/" + fileDetail.getFileName();
System.out.println("Testing for file download");
// save it
writeToFile(uploadedInputStream, uploadedFileLocation);
String output = "File uploaded to : " + uploadedFileLocation;
return Response.status(200).entity(output).build();
}
but i am getting following error on webservice side...
Apr 13, 2017 3:29:11 PM com.sun.jersey.spi.container.ContainerRequest getEntity
SEVERE: A message body reader for Java class com.sun.jersey.core.header.FormDataContentDisposition, and Java type class com.sun.jersey.core.header.FormDataContentDisposition, and MIME media type multipart/form-data was not found.
The registered message body readers compatible with the MIME media type are:
*/* ->
com.sun.jersey.core.impl.provider.entity.FormProvider
com.sun.jersey.core.impl.provider.entity.StringProvider
com.sun.jersey.core.impl.provider.entity.ByteArrayProvider
com.sun.jersey.core.impl.provider.entity.FileProvider
com.sun.jersey.core.impl.provider.entity.InputStreamProvider
com.sun.jersey.core.impl.provider.entity.DataSourceProvider
com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$General
com.sun.jersey.core.impl.provider.entity.ReaderProvider
com.sun.jersey.core.impl.provider.entity.DocumentProvider
com.sun.jersey.core.impl.provider.entity.SourceProvider$StreamSourceReader
com.sun.jersey.core.impl.provider.entity.SourceProvider$SAXSourceReader
com.sun.jersey.core.impl.provider.entity.SourceProvider$DOMSourceReader
com.sun.jersey.json.impl.provider.entity.JSONJAXBElementProvider$General
com.sun.jersey.json.impl.provider.entity.JSONArrayProvider$General
com.sun.jersey.json.impl.provider.entity.JSONObjectProvider$General
com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$General
com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$General
com.sun.jersey.core.impl.provider.entity.XMLRootObjectProvider$General
com.sun.jersey.core.impl.provider.entity.EntityHolderReader
com.sun.jersey.json.impl.provider.entity.JSONRootElementProvider$General
com.sun.jersey.json.impl.provider.entity.JSONListElementProvider$General
com.sun.jersey.json.impl.provider.entity.JacksonProviderProxy
Kindly check my code...and guide me how to resolve the issue...

android upload file on shared folder inside htdocs

I need to upload file on shared folder inside lampp ht-docs directory.
The file is inside internal storage. I have also path of that file with me.
I have tried some of the solutions but it is not moving file to that shared folder inside lampp ht-docs.
I have the URL like this http://192.168.1...../OrderFiles/. OrderFiles is the shared folder inside lampp htdocs directory. I want to upload file here from file path of internal storage.
Here is what i have tried.
public void uploadLocal() {
HttpURLConnection conn = null;
DataOutputStream dos = null;
DataInputStream inStream = null;
File fileName = new File(DBController.lastXmlPathLocal);
Log.w("getAbsolutePath", fileName.getAbsolutePath());
Log.w("getPath", fileName.getPath());
String existingFileName = fileName.getAbsolutePath();
Log.w("existingFileName", existingFileName);
String lineEnd = "\r\n";
String twoHyphens = "--";
String boundary = "*****";
int bytesRead, bytesAvailable, bufferSize;
byte[] buffer;
int maxBufferSize = 1 * 1024 * 1024;
String responseFromServer = "";
String urlString = "http://192.168.1......./OrderFiles/";
Log.w("urlString", urlString);
try {
//------------------ CLIENT REQUEST
FileInputStream fileInputStream = new FileInputStream(new File(fileName.getPath()));
// open a URL connection to the Servlet
URL url = new URL(urlString);
// Open a HTTP connection to the URL
conn = (HttpURLConnection) url.openConnection();
// Allow Inputs
conn.setDoInput(true);
// Allow Outputs
conn.setDoOutput(true);
// Don't use a cached copy.
conn.setUseCaches(false);
// Use a post method.
conn.setRequestMethod("POST");
conn.setRequestProperty("Connection", "Keep-Alive");
conn.setRequestProperty("Content-Type", "multipart/form-data;boundary=" + boundary);
dos = new DataOutputStream(conn.getOutputStream());
dos.writeBytes(twoHyphens + boundary + lineEnd);
dos.writeBytes("Content-Disposition: form-data; name=\"uploadedfile\";filename=\"" + existingFileName + "\"" + lineEnd);
dos.writeBytes(lineEnd);
// create a buffer of maximum size
bytesAvailable = fileInputStream.available();
bufferSize = Math.min(bytesAvailable, maxBufferSize);
buffer = new byte[bufferSize];
// read file and write it into form...
bytesRead = fileInputStream.read(buffer, 0, bufferSize);
//while (bytesRead > 0)
Log.v("info", ".size." + bytesRead);
for (int n1 = 0; n1 < bytesRead; n1++) {
dos.write(buffer, 0, bufferSize);
bytesAvailable = fileInputStream.available();
bufferSize = Math.min(bytesAvailable, maxBufferSize);
bytesRead = fileInputStream.read(buffer, 0, bufferSize);
}
dos.writeBytes(lineEnd);
dos.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd);
// close streams
Log.v("info", "File is written");
fileInputStream.close();
dos.flush();
dos.close();
} catch (MalformedURLException ex) {
Log.v("info", "error: " + ex.getMessage(), ex);
} catch (IOException ioe) {
Log.v("info", "error: " + ioe.getMessage(), ioe);
}
/*//------------------ read the SERVER RESPONSE
try {
inStream = new DataInputStream(conn.getInputStream());
String str;
while ((str = inStream.readLine()) != null) {
Log.v("info", "Server Response " + str);
}
inStream.close();
} catch (IOException ioex) {
Log.v("info", "error: " + ioex.getMessage(), ioex);
}*/
}
The above code showing File is written in logcat but inside that folder not showing any of the file.
Is their any other solution to integrate this ?
Any help would be greatly appreciated.
First you need a php script to upload a file to begin with. And after that the php script should contain code to move the uploaded file to your wanted folder. And that is how it goes. And that is how you should do it.

Sending image to webservice using asynctask

I have got an app that can take a picture and deliver me an uri of the given picture.
Next thing, I want to do is send this picture to my webservices.
But, Once i tried that, i got an error that i have had before, which relates to asynctask. So tried to work around it, i have got a HttpManager class which holds the information on how to connect to the webservice, the url itself and where it handles the image uri.
public static String uploadImageToWebservice(String uri, String imageUri) {
HttpURLConnection connection = null;
int responseCode = 0;
String image = "";
try {
URL url = new URL(uri + imageUri);
connection = (HttpURLConnection) url.openConnection();
connection.setDoOutput(true);
connection.setInstanceFollowRedirects(false);
connection.setRequestMethod("GET");
connection.setRequestProperty("Content-Type", "text/plain");
/*
* String userpassword = adminUser + ":" + adminPassword; String
* encodedAuthorization = DatatypeConverter
* .printBase64Binary(userpassword.getBytes("UTF-8"));
* connection.setRequestProperty("Authorization", "Basic " +
* encodedAuthorization);
*/
InputStream is = connection.getInputStream();
image = is.toString();
responseCode = connection.getResponseCode();
connection.disconnect();
} catch (IOException e) {
Log.e("URL", "failure response from server >" + e.getMessage()
+ "<");
} finally {
if (connection != null) {
connection.disconnect();
}
}
return image;
}
And this is how i handle this method in my activity.
private void submitImage(String uri) {
HttpAsyncTask at = new HttpAsyncTask();
at.execute(uri);
}
private class HttpAsyncTask extends AsyncTask<String, String, String> {
#Override
protected String doInBackground(String... params) {
String image = HttpManager.uploadImageToWebservice(params[0],
params[1]);
return image;
}
}
And then i call the submitImage method in the oncreate with the Uri of the webservice.
But I'm kind of stuck on where to put in the uri of the image itself for it to be sent as well. I just feel like I'm missing something and i can't figure out where it is. Hopefully its to understand all of this.
Thanks in advance!
use code for uploading image
HttpURLConnection conn = null;
DataOutputStream dos = null;
String lineEnd = "\r\n";
String twoHyphens = "--";
String boundary = "*****";
int bytesRead, bytesAvailable, bufferSize;
byte[] buffer;
int maxBufferSize = 1 * 1024 * 1024;
FileInputStream fileInputStream = new FileInputStream("sourcefile");
URL url = new URL("URL");
// Open a HTTP connection to the URL
conn = (HttpURLConnection) url.openConnection();
conn.setDoInput(true); // Allow Inputs
conn.setDoOutput(true); // Allow Outputs
conn.setUseCaches(false); // Don't use a Cached Copy
conn.setRequestMethod("POST");
conn.setRequestProperty("Connection", "Keep-Alive");
conn.setRequestProperty("ENCTYPE", "multipart/form-data");
conn.setRequestProperty("Content-Type",
"multipart/form-data;boundary=" + boundary);
conn.setRequestProperty("bill", sourceFileUri);
dos = new DataOutputStream(conn.getOutputStream());
dos.writeBytes(twoHyphens + boundary + lineEnd);
dos.writeBytes("Content-Disposition: form-data; name=\"bill\";filename=\""
+ sourceFileUri + "\"" + lineEnd);
dos.writeBytes(lineEnd);
// create a buffer of maximum size
bytesAvailable = fileInputStream.available();
bufferSize = Math.min(bytesAvailable, maxBufferSize);
buffer = new byte[bufferSize];
// read file and write it into form...
bytesRead = fileInputStream.read(buffer, 0, bufferSize);
while (bytesRead > 0) {
dos.write(buffer, 0, bufferSize);
bytesAvailable = fileInputStream.available();
bufferSize = Math.min(bytesAvailable, maxBufferSize);
bytesRead = fileInputStream.read(buffer, 0, bufferSize);
}
// send multipart form data necesssary after file
// data...
dos.writeBytes(lineEnd);
dos.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd);
// Responses from the server (code and message)
serverResponseCode = conn.getResponseCode();
// String serverResponseMessage = conn
// .getResponseMessage();
if (serverResponseCode == 200) {
statud = "uploaded";
// messageText.setText(msg);
// Toast.makeText(ctx, "File Upload Complete.",
// Toast.LENGTH_SHORT).show();
// System.out.println("Uploaded successfyuly http: 200");
// recursiveDelete(mDirectory1);
}
// close the streams //
fileInputStream.close();
dos.flush();
dos.close();
php code
<?php
$uploads_dir = './images/';
$tmp_name = $_FILES['bill']['tmp_name'];
$pic_name = $_FILES['bill']['name'];
if (move_uploaded_file($tmp_name, $uploads_dir.$pic_name )) {
echo "uploaded";
}
?>

Upload and download 2 or more files to/from server

I am trying to make an app that can connect android app to the server, and I need to upload and download 2 or more files
I found this code
private void doFileUpload() {
HttpURLConnection conn = null;
DataOutputStream dos = null;
DataInputStream inStream = null;
String existingFileName = Environment.getExternalStorageDirectory()
.getAbsolutePath() + "/android/data/[package]/files/productHistory";
**String existingFileName2 = Environment.getExternalStorageDirectory()
.getAbsolutePath() + "/android/data/[package]/files/productStock";**
String lineEnd = "\r\n";
String twoHyphens = "--";
String boundary = "*****";
int bytesRead, bytesAvailable, bufferSize;
byte[] buffer;
int maxBufferSize = 1 * 1024 * 1024;
String responseFromServer = "";
String urlString = "http://192.168.1.112/johnson/learn/android/";
try {
// ------------------ CLIENT REQUEST
FileInputStream fileInputStream = new FileInputStream(new File(
existingFileName));
// open a URL connection to the Servlet
URL url = new URL(urlString);
// Open a HTTP connection to the URL
conn = (HttpURLConnection) url.openConnection();
// Allow Inputs
conn.setDoInput(true);
// Allow Outputs
conn.setDoOutput(true);
// Don't use a cached copy.
conn.setUseCaches(false);
// Use a post method.
conn.setRequestMethod("POST");
conn.setRequestProperty("Connection", "Keep-Alive");
conn.setRequestProperty("Content-Type",
"multipart/form-data;boundary=" + boundary);
dos = new DataOutputStream(conn.getOutputStream());
dos.writeBytes(twoHyphens + boundary + lineEnd);
dos.writeBytes("Content-Disposition: form-data; name=\"uploadedfile\";filename=\""
+ existingFileName + "\"" + lineEnd);
**dos.writeBytes("Content-Disposition: form-data; name=\"uploadedfile\";filename=\""
+ existingFileName2 + "\"" + lineEnd);**
dos.writeBytes(lineEnd);
// create a buffer of maximum size
bytesAvailable = fileInputStream.available();
bufferSize = Math.min(bytesAvailable, maxBufferSize);
buffer = new byte[bufferSize];
// read file and write it into form...
bytesRead = fileInputStream.read(buffer, 0, bufferSize);
while (bytesRead > 0) {
dos.write(buffer, 0, bufferSize);
bytesAvailable = fileInputStream.available();
bufferSize = Math.min(bytesAvailable, maxBufferSize);
bytesRead = fileInputStream.read(buffer, 0, bufferSize);
}
// send multipart form data necesssary after file data...
dos.writeBytes(lineEnd);
dos.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd);
// close streams
Log.e("Debug", "File is written");
fileInputStream.close();
dos.flush();
dos.close();
} catch (MalformedURLException ex) {
Log.e("Debug", "error: " + ex.getMessage(), ex);
} catch (IOException ioe) {
Log.e("Debug", "error: " + ioe.getMessage(), ioe);
}
// ------------------ read the SERVER RESPONSE
try {
inStream = new DataInputStream(conn.getInputStream());
String str;
while ((str = inStream.readLine()) != null) {
Log.e("Debug", "Server Response " + str);
}
inStream.close();
} catch (IOException ioex) {
Log.e("Debug", "error: " + ioex.getMessage(), ioex);
}
}
The bold text is edited by me,
but it is fail, it only upload the first one
my question is 1. how to upload 2/more files with the code?
2. and how to download them?
thanks in advance
Not sure if you have to use a specific server, yet Parse offers a sweet SDK with intuitive API to send/receive data (images in you case) to and from the server. I'd suggest you try that out if you don't want to spend to much time writing code that sends and receives data to and from a server. (and no, I don't work at Parse, just a big fan of their tools :P).

Android emulator file read permission

I need to upload a file from my android emulator directory ('data\data\org.mypackage\file.dat') to a remote server, but when I try to access the file it gives an error like 'error: Permission denied', I store my sqlite database in 'data\data\org.mypackage\databases\' folder , during the application startup if there is no sqlite db in that folder I copied it from my asset folder to that directory and access it from there it works perfect but in the case upload task it ask for permission why this occur? following is my uploadFile method
private void uploadFile(){
HttpURLConnection conn = null;
DataOutputStream dos = null;
DataInputStream inStream = null;
String existingFileName="/data/data/org.mypackage/file.dat";
GeneralFunctions.comment(existingFileName);
String lineEnd = "\r\n";
String twoHyphens = "--";
String boundary = "*****";
int bytesRead, bytesAvailable, bufferSize;
byte[] buffer;
int maxBufferSize = 1*1024*1024;
String responseFromServer = "";
String urlString = "http://117.231.150.213:8080/upload.jsp";
try
{
//------------------ CLIENT REQUEST
FileInputStream fileInputStream = new FileInputStream(new File(existingFileName) );
// open a URL connection to the Servlet
URL url = new URL(urlString);
// Open a HTTP connection to the URL
conn = (HttpURLConnection) url.openConnection();
// Allow Inputs
conn.setDoInput(true);
// Allow Outputs
conn.setDoOutput(true);
// Don't use a cached copy.
conn.setUseCaches(false);
// Use a post method.
conn.setRequestMethod("POST");
conn.setRequestProperty("Connection", "Keep-Alive");
conn.setRequestProperty("Content-Type", "multipart/form-data;boundary="+boundary);
dos = new DataOutputStream( conn.getOutputStream() );
dos.writeBytes(twoHyphens + boundary + lineEnd);
dos.writeBytes("Content-Disposition: form-data; name=\"uploadedfile\";filename=\"" + existingFileName + "\"" + lineEnd);
dos.writeBytes(lineEnd);
// create a buffer of maximum size
bytesAvailable = fileInputStream.available();
bufferSize = Math.min(bytesAvailable, maxBufferSize);
buffer = new byte[bufferSize];
// read file and write it into form...
bytesRead = fileInputStream.read(buffer, 0, bufferSize);
while (bytesRead > 0)
{
dos.write(buffer, 0, bufferSize);
bytesAvailable = fileInputStream.available();
bufferSize = Math.min(bytesAvailable, maxBufferSize);
bytesRead = fileInputStream.read(buffer, 0, bufferSize);
}
// send multipart form data necesssary after file data...
dos.writeBytes(lineEnd);
dos.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd);
// close streams
GF.showToast("File is written");
fileInputStream.close();
dos.flush();
dos.close();
}
catch (Exception ex)
{
GeneralFunctions.exception("error: " + ex.getMessage());
}
//------------------ read the SERVER RESPONSE
try {
inStream = new DataInputStream ( conn.getInputStream() );
String str;
while (( str = inStream.readLine()) != null)
{
GeneralFunctions.comment("Server Response "+str);
}
inStream.close();
}
catch (Exception ioex){
GeneralFunctions.exception("error: " + ioex.getMessage());
}
}
Add INTERNET permission to your manifest.
If you can provide logcat then it will help more.

Categories

Resources