Scenario - upload binary data in the body of a post, handle a response body containing JSON.
How to do the following using Volley?
curl -X POST -H "X-Application-Id: 3KxPB" -H "X-REST-API-Key: jkuI9" -H "Content-Type: audio/3gp" --data-binary '@test.3gp' https://host/1/files/audio
IMO - there is a gap in Volley handling binary POST body types that apache httpclient handles in subclasses of abstracthttpentity. If buffered binary data generated on the phone by camera, microphone, or other binary output sensors needs a mechanism to be wrapped and written to the body of a POST how to do it in volley?
I've looked at PoolingByteArrayOutputStream and would like to do something like fill the buffer and get the PBAOutStrm ,writing to PBAOutStrm from the buffer and then flipping OutStrm to InputStream and then wrap it in the body of a POST request as something like a ByteArrayEntity. I cant see how to do that in volley.
To send binary data you can do something like what I did in this answer How to send a “multipart/form-data” POST in Android with Volley .
I was able to solve this using a Volley GsonRequest:
public class MainActivity extends AppCompatActivity {