How do I upload file (image) that I have his Uri, into custom object?
I've tried this:
public void onClick(View v) {
HashMap<String, Object> fields = new HashMap<String, Object>();
File newImage = new File(imageUri.toString());
fields.put("image", newImage);
fields.put("bla", "bla");
QBCustomObject qbCustomObject = new QBCustomObject();
qbCustomObject.setClassName("imageClass"); // your Class name
qbCustomObject.setFields(fields);
QBCustomObjects.createObject(qbCustomObject, new QBCallbackImpl() {
@Override
public void onComplete(Result result) {
if (result.isSuccess()) {
QBCustomObjectResult qbCustomObjectResult = (QBCustomObjectResult) result;
QBCustomObject qbCustomObject = qbCustomObjectResult.getCustomObject();
// Log.d("New record: ",newCustomObject.toString());
} else {
Log.e("Errors",result.getErrors().toString());
}
}
});
And I get just the string ("bla") and the image get - null
Thank you
Currently this feature is in development brunch. Will be in master in a couple of days
But you can use it already - Download SDK from development brunch https://github.com/QuickBlox/quickblox-android-sdk/tree/development
Here are lots of snippets, especially for Custom Objects module
https://github.com/QuickBlox/quickblox-android-sdk/blob/development/snippets/src/com/quickblox/snippets/modules/SnippetsCustomObjects.java
Upload file
Download file
Delete file