Created
July 3, 2016 14:35
-
-
Save cyberrob-zz/de34596d1c15e76907a700521d9b25c0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Map<String, RequestBody> map = new HashMap<>(); | |
map.put("data", APIUtils.toRequestBody(new Gson().toJson(matchRequest))); | |
RequestBody requestBody = RequestBody.create( | |
MediaType.parse("multipart/form-data"), | |
FileUtils.file2bytes(new File(audioFilePath)) | |
); | |
map.put("audio\"; filename=\"match_audio.mp4\"", requestBody); | |
Client.getInterface() | |
.createMatch( | |
PrefUtils.getUserToken(getActivity()), | |
map | |
) | |
.subscribe(new Subscriber<Match>() { | |
@Override public void onCompleted() { | |
} | |
@Override public void onError(Throwable e) { | |
} | |
@Override public void onNext(Match match) { | |
if (match != null) { | |
Match.printMatchContent(match); | |
Toast.makeText(getContext(), "Match created!", Toast.LENGTH_SHORT).show(); | |
getActivity().finish(); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment