0
我正在尝试更改OneSignal推送通知中当前的“测试消息”字符串。我只是想使用我的代码中定义的变量,但不知道如何去做。在OneSignal通知中编辑邮件内容Android
try {
OneSignal.postNotification(new JSONObject("{'contents': ['en': 'Test Message'], 'include_player_ids': ['" + selectedUser.getOneSignalId() + "']}"),
new OneSignal.PostNotificationResponseHandler() {
@Override
public void onSuccess(JSONObject response) {
Log.i("OneSignalExample", "postNotification Success: " + response.toString());
}
@Override
public void onFailure(JSONObject response) {
Log.e("OneSignalExample", "postNotification Failure: " + response.toString());
}
});
} catch (JSONException f) {
e.printStackTrace();
}
我在向选定用户发送通知时能够实现类似的功能。现在我只想改变实际消息的文本。
当我尝试第一种方法时,我得到了这个。 java.lang.ClassCastException:org.json.JSONArray不能转换为com.onesignal.OneSignal $ PostNotificationResponseHandler –