Volley upload file/image without using httpcilent - android

as MultipartEntity is removed from sdk 23 what is best way to upload images with other string params to server .
i did refer How to upload file using Volley library in android? but here only file are present
how i can upload image using volley

Use this below link. You can know more about volley
http://www.androidhive.info/2014/05/android-working-with-volley-library-1/
Retrofit is another rest client to know more about retrofit see the below link
http://square.github.io/retrofit/

Related

Send an image to a server using HttpURLConnection

I have to send an image to a server (I think the best option is using HttpURLConnection) and recieve from it a String answer. In the different docuemnts and web sites that I have read, I have investigated that the best way to do this is using MultipartEntity.
1_ Is it the best solution to do it?
2_ I had an error which says that Android Studio cannot resolve the symbol 'MultipartEntity'. I read that to solve it I have to download external libraries. Which are them and how can I download them?
3_ For this I want to run this process in backGround, but I have a mistake writing the AsyncTask like AsyncTask<String, Void, String> because I want to recieve the parameters like in the answer from this question (Sending files using POST with HttpURLConnection): String urlString, MultipartEntity reqEntity. How can I do to resolve it?
I think the best option is using HttpURLConnection
Is it the best solution to do it?
Probably not. It's too low-level for multi-part requests.
I had an error which says that Android Studio cannot resolve the symbol 'MultipartEntity'. I read that to solve it I have to download external libraries. Which are them and how can I download them?
Options include, but not limited to
Apache HTTP (which is where MultipartEntity comes from)
OkHttp with a multipart example
VolleyPlus
You can get either using Gradle. For Apache see: Android - MultipartEntity and dependencies, and Okhttp just read their documentation where it says "Gradle"
For this I want to run this process in Background
Can't remember about Apache, but OkHttp already can handle that without an AsyncTask.

How to POST multiple large image files via Volley Android

I am trying to post around 10 images via volley by converting it to base64 but Volley post the images multiple time due to its retry policy. I am already compressing the files and i also tried changing its timeout but problem still exist. Retrofit also doing same.
Why do you need/use base64?
Are you using get rather than post?
Use multipart file upload for large files, for instance (with retrofit):
public interface FileUploadService {
#Multipart
#POST("/upload")
void upload(#Part("myfile") TypedFile file,
#Part("description") String description,
Callback<String> cb);
}
You can use Android Asynchronous Http Client for multipart request.
Refer this link
HttpClient support Base64.

How to use session and redirect in Volley library

I can request to my API by this python code snippet (use requests python):
session = requests.session()
r=session.post(url,data=post_data, auth=(username , passwd))
Server will use this session and redirect my request to another get request then return the json response successfully.
I want to implement this api request on Android using Volley library. I have figured all day, and there is no luck. I can request an GET api successfully, but POST.
I have tried all answer on this question on SO
It seem I cannot create a session for Volley can use it.
Does anyone have experience in using session/cookie for Volley library?

Upload file via POST request without HttpClicent

As I read, HttpClient is deprecated since Android API 22. That's why I don't want to use it. I need to upload file vie POST request with possibility to track upload progress. Is there way to do it?
You can use HttpUrlConnection with Asyctask to show progress.
Also you can refer this link for the same.

Calling Nest REST API on from android app without using Firebase SDK

Including Firebase.jar file in my android app project will cause reaching 64k dex limit. So, I'd like to use REST API instead of Firebase API.
After I got access token, I try to use either HttpPut or HttpsURLConnection to change thermostat mode. By using HttpsURLConnection, I got http response code 307 to ask me to redirect to firebase-apiserverN url. Then, I use the new URL and do a HttpsURLConnection PUT, I got http response code 400.
Is there any Nest API sample code for android without Firebase? Thanks.

Categories

Resources