Maksim Morozov Maksim Morozov - 10 months ago 195
JSON Question

Read a title of OneSignal Notification in PhoneGap

I use PhoneGap Build and OneSignal.
How can I read a title of notification in PhoneGap Project.
There is my code

receivedEvent: function(id) {
var iosSettings = {};
iosSettings["kOSSettingsKeyAutoPrompt"] = true;
iosSettings["kOSSettingsKeyInAppLaunchURL"] = false;

window.plugins.OneSignal.startInit( "*************************", "************")

function didReceiveRemoteNotificationCallBack(jsonData) {
alert('RECEIVE: ' + JSON.stringify(jsonData));
function didOpenRemoteNotificationCallBack (jsonData) {
alert('OPEN: ' + JSON.stringify(jsonData));


How to get a TITLE when Notification receive?
I found a Documentations but I don't understand

Answer Source

You can get it by calling jsonData.payload.title in your didReceiveRemoteNotificationCallBack function. See Onesignal's NotificationReceivedHandler documentation for a full list of properties.