post #1 of 1
Thread Starter 
hello everyone,

I have been trying to insert some data into a server database using my application.
I already had a way to do this using the httpEntity and httpClient object. However, this object was deprecated (removed) sins API 23 (Android 6.0).

They now want us to use the HttpURLConnection object. And while i have succesfully managed to get some JSON info from a php file stored on the database server, i have yet to figure out how to insert data into it using somewhat of the same method.

The official android website gives us this code snippet below but the "writeStream(out);" and "readStream(in);" are ones we have to make ourselves and after a lot of online research have yet to understand in a simple way.
Code:
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
   try {
     urlConnection.setDoOutput(true);
     urlConnection.setChunkedStreamingMode(0);

     OutputStream out = new BufferedOutputStream(urlConnection.getOutputStream());
     writeStream(out);

     InputStream in = new BufferedInputStream(urlConnection.getInputStream());
     readStream(in);
    finally {
     urlConnection.disconnect();
   }

what i am asking is :
- how do i impliment this writeStream() ?
- Do i even need a php file using this type of method ?
- If so, do i still use $_Request["myDataName"] to still get my variables ?


Your help will be much appreciated.

Good day to you all.