Hy guys!
I am working on an android project(java
) with another guy working on the server-side(php)
. In my application I need to call POST
and GET
methods in order to upload files to server, download files, send Strings, byte[] array etc
.
My question is: What is the best library to use in my case?(I think my files will not exceed 3mb
)
I am new in android so I tried so far:
1.Android Asynchronous Http Client
(com.loopj.android:android-async-http:x.x.x)
-we gave up to this because it is not from a "trusted" source
2.AsyncTask+HttpClient+HttpPost
-we gave up to this too
3.Volley library
-best so far(for strings, image request), but it needs additional libraries to send images to server(org.apache.httpcomponents:httpmime:4.5
)
-I followed so examples from here but I got exceptions, error, libraries error(duplicates) and never managed to solve one without other showing up.
-so I gave up on this too
My question posted for volley library
here
4. Now I am thinking about using Retrofit
, but dont know it fits my needs:
-send strings and all types of primitive data
-send image/images to server(together with an Api key
)
-download image/images from server
Tell me if I am wrong somewhere or if I missed something working with the libraries specified above. I managed to send simple data with all of these, but I didnt managed to send Files
(excepting loopj
library).
Do you think should I go back to Volley
, or starting reading about Retrofit
? Volley
seems to be the most flexible one, but not for uploading files
.
Any reference or advice is welcome! Thanks in advance!
Update:
I found a possible solution for my problem:
-I convert my file/image to a byte array
and encode
it to a base64 string
-I send the string to server as basic StringRequest
with HashMap<String,String>
(Using Volley library from Google developers)
-The server decode the string a save the file