Start a conversation

How to Create new Record in QuickBlox custom table?

<h1 dir="ltr" style="line-height: 1.3; margin-top: 10pt; margin-bottom: 5pt;"><span style="font-size: 15px; font-family: Arial; color: #3f4549; background-color: #ffffff; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">How to Create new Record in QuikcBlox custom table?</span></h1> <p>Android.</p> <p>In order to create record you need to be logged in http://quickblox.com/developers/SimpleSample-users-android#Sign_In_.26_Social_authorization</p> <p>Next, the following can be used:<br /><br />HashMap<String, Object> fields = new HashMap<String, Object>();<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fields.put("senderLoginID", ""+mylogin.toString());<br />&nbsp;&nbsp;&nbsp; fields.put("receiverLoginID", ""+friendLogin.toString());<br />&nbsp;&nbsp;&nbsp; fields.put("messages", messageString);<br /><br />&nbsp;&nbsp;&nbsp; fields.put("isRead", false);<br /><br /><br />QBCustomObject qbCustomObject = new QBCustomObject();<br />qbCustomObject.setClassName("Movie");&nbsp; // your Class name<br />qbCustomObject.setFields(fields);<br />QBCustomObjects.createObject(qbCustomObject, new QBCallbackImpl() {<br />&nbsp;&nbsp;&nbsp; @Override<br />&nbsp;&nbsp;&nbsp; public void onComplete(Result result) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (result.isSuccess()) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; QBCustomObjectResult qbCustomObjectResult = (QBCustomObjectResult) result;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; QBCustomObject qbCustomObject = qbCustomObjectResult.getCustomObject();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Log.d("New record: ",newCustomObject.toString());<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Log.e("Errors",result.getErrors().toString());<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp; }<br />});</p> <p>&nbsp;</p> <p>iOS.</p> <p>&nbsp;</p> <p>How to use custom objects</p> <p><a href="http://quickblox.com/developers/SimpleSample-customObjects-ios">http://quickblox.com/developers/SimpleSample-customObjects-ios</a></p> <p>&nbsp;</p>
Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Maksym Pidhorbunskyi

  2. Posted

Comments