I need to send a byte array in a post request. I'm trying using volley, but I only know how to send post with only String parameters. Specifically I need to fill the following fields in the request:
params.add(new BasicNameValuePair("Id", ""));
params.add(new BasicNameValuePair("Empresa", "1"));
params.add(new BasicNameValuePair("Matricula", "1"));
params.add(new BasicNameValuePair("Foto", bytearray[] here)); << this is the field that need byte array
params.add(new BasicNameValuePair("Data", "11/22/2020 16:30:00"));
params.add(new BasicNameValuePair("GPS", "0"));
params.add(new BasicNameValuePair("idDispositivo", "0"));
params.add(new BasicNameValuePair("arquivo", ""));
params.add(new BasicNameValuePair("face", "0"));
params.add(new BasicNameValuePair("ip", "0.0"));
I know that the method above doesn't work. It's just an example of how I have to fill the post request.
I saw this answer in C#: Post byte array to Web API server using HttpClient. I need something like that in Java.
Encoding the byte array in Base64 String doesn't solve my problem.
I accept any method that can solve my problem, I don't need specifically do the post request with volley.
PS.: Sorry for my bad english.