How to add few custom data fields for new QBUser? I know how to make it for single custom data field.
public static String customDataToString(String key,String value) {
JSONObject jsonObject = new JSONObject();
setJsonValue(jsonObject, key,value);
return jsonObject.toString();
}
private static void setJsonValue(JSONObject jsonObject, String key, String value) {
if (!TextUtils.isEmpty(value)) {
try {
jsonObject.put(key, value);
} catch (JSONException e) {
e.printStackTrace();
}
}
}
Should I use jsonarray or something to make it work with multiple fields?
The user's custom data is just a string and you can put any values right here.
To put many fields you can user JSON for example.