As per Firebase, I have migrated my FCM to new FCM V1.
But Everything is not perfectly worked as expected
RequestQueue requestQueue = Volley.newRequestQueue(fcmModal.getmActivity());
JSONObject mainObj = new JSONObject();
try {
JSONObject messageObject = new JSONObject();
messageObject.put("token", fcmModal.getUserFcmToken());
JSONObject notificationObject = new JSONObject();
notificationObject.put("title", fcmModal.getTitle());
notificationObject.put("body", fcmModal.getBody());
// notificationObject.put("icon", fcmModal.getIcon());
// notificationObject.put("channel_name", fcmModal.getChannelId());
// notificationObject.put("requestCode", fcmModal.getRequestCode());
messageObject.put("notification", notificationObject);
// JSONObject dataObj = new JSONObject();
// dataObj.put("requestCode",fcmModal.getRequestCode());
// messageObject.put("data",dataObj);
mainObj.put("message", messageObject);
JsonObjectRequest request = new JsonObjectRequest(Request.Method.POST, postUrl, mainObj, response -> {
// showLog("request: Success");
}, volleyError -> {
showLog("Error: " + volleyError);
}) {
@Override
public Map<String, String> getHeaders() {
String accessKey = getAccessToken();
Map<String, String> header = new HashMap<>();
header.put("content-type", "application/json");
header.put("authorization", "Bearer " + accessKey);
return header;
}
};
requestQueue.add(request);
} catch (JSONException e) {
showLog("Volley: " + e.getMessage());
}
}
it just works when passing title and body only. But
it gives volley server error when passing other parameters, (Commented out in above code), such as icon, channel_id, requestCodes, data
I tried changing as per the attachment But I still got same error.
Please help me to figure out the issues.
It is very important for my project with icons and request codes too.