Но Не все работает так, как ожидалось
Код: Выделить всё
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 getHeaders() {
String accessKey = getAccessToken();
Map 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());
}
}
он выдает ошибку сервера залпа при передаче других параметров (закомментировано в приведенном выше коде), таких как значок,channel_id, requestCodes, данные
Я попробовал внести изменения согласно вложению, но ошибка все равно возникла.
[img]https:// i.sstatic.net/vT3ExxRo.png[/img]
Пожалуйста, помогите мне разобраться в проблемах.
Это очень важно и для моего проекта с иконками и кодами запросов.
Подробнее здесь: https://stackoverflow.com/questions/789 ... rom-legacy
Мобильная версия