PhoneGapPhoneGapNode.jsReact V4WebJavaScriptPhoneGap V4 Mobile Push API Reference for Realtime Apps

Go to Storage & Playback


Requires Mobile Push Notifications add-on XRequires that the Mobile Push Notifications add-on is enabled for your key. See this page on enabling add-on features on your keys:

http://www.pubnub.com/knowledge-base/discussion/644/how-do-i-enable-add-on-features-for-my-keys.
Enable push notifications on provided set of channels.
To run Adding Device to Channel you can use the following method(s) in the PhoneGap V4 SDK
  1. ParameterTypeRequiredDescription
    Operation ArgumentsHashYesA hash of arguments.
    channelsArrayYesSpecifies channel to associate with push notifications.
    deviceStringYesThe device id to associate with push notifications.
    pushGateway StringYesapns, mpns or gcm.
    callbackFunctionOptionalExecutes on a successful/unsuccessful addChannels.
pubnub.push.addChannels(
    {
        channels: ['a', 'b'],
        device: 'niceDevice',
        pushGateway: 'apns' // apns, gcm, mpns
    },
    function(status) {
        if (status.error) {
            console.log("operation failed w/ error:", status);
        } else {
            console.log("operation done!")
        }
    }
);
{
    error: false,
    operation: 'PNPushNotificationEnabledChannelsOperation',
    statusCode: 200
}
Requires Mobile Push Notifications add-on XRequires that the Mobile Push Notifications add-on is enabled for your key. See this page on enabling add-on features on your keys:

http://www.pubnub.com/knowledge-base/discussion/644/how-do-i-enable-add-on-features-for-my-keys.
Request for all channels on which push notification has been enabled using specified pushToken.
To run Listing Channels For Device you can use the following method(s) in the PhoneGap V4 SDK
  1. ParameterTypeRequiredDescription
    Operation ArgumentsHashYesA hash of arguments.
    deviceStringYesThe device id to associate with push notifications.
    pushGateway StringYesapns, mpns or gcm.
    callbackFunctionOptionalExecutes on a successful/unsuccessful listChannels.
pubnub.push.listChannels(
    {
        device: 'niceDevice',
        pushGateway: 'apns' // apns, gcm, mpns
    },
    function (status, response) { 
        if (status.error) { 
            console.log("operation failed w/ error:", status);
            return;
        }

        console.log("listing push channel for device")
        response.channels.forEach( function (channel) {
            console.log(channel)
        })
    }
);
// Example of status
{
    error: false,
    operation: 'PNPushNotificationEnabledChannelsOperation',
    statusCode: 200
}

// Example of response
{
    channels: [ 'a', 'b' ]
}
Requires Mobile Push Notifications add-on XRequires that the Mobile Push Notifications add-on is enabled for your key. See this page on enabling add-on features on your keys:

http://www.pubnub.com/knowledge-base/discussion/644/how-do-i-enable-add-on-features-for-my-keys.
Disable push notifications on provided set of channels.
To run Removing Device From Channel you can use the following method(s) in the PhoneGap V4 SDK
  1. ParameterTypeRequiredDescription
    Operation ArgumentsHashYesA hash of arguments.
    channelsArrayYesSpecifies channel to associate with push notifications.
    deviceStringYesThe device id to associate with push notifications.
    pushGateway StringYesapns, mpns or gcm.
    callbackFunctionOptionalExecutes on a successful/unsuccessful removeChannels.
pubnub.push.removeChannels(
    {
        channels: ['a', 'b'], 
        device: 'niceDevice', 
        pushGateway: 'apns' // apns, gcm, mpns
    },
    function(status) {
        if (status.error) {
            console.log("operation failed w/ error:", status);
        } else {
            console.log("operation done!")
        }
    }
);
{
    error: false,
    operation: 'PNPushNotificationEnabledChannelsOperation',
    statusCode: 200
}
Requires Mobile Push Notifications add-on XRequires that the Mobile Push Notifications add-on is enabled for your key. See this page on enabling add-on features on your keys:

http://www.pubnub.com/knowledge-base/discussion/644/how-do-i-enable-add-on-features-for-my-keys.
Disable push notifications from all channels which is registered with specified pushToken.
To run Remove all push notifications you can use the following method(s) in the PhoneGap V4 SDK
  1. ParameterTypeRequiredDescription
    Operation ArgumentsHashYesA hash of arguments.
    deviceStringYesThe device id to associate with push notifications.
    pushGateway StringYesapns, mpns or gcm.
    callbackFunctionOptionalExecutes on a successful/unsuccessful deleteDevice.
pubnub.push.deleteDevice(
    {
        device: 'niceDevice', 
        pushGateway: 'apns' // apns, gcm, mpns
    }, 
    function (status) {
        if (status.error) {
            console.log("operation failed w/ error:", status);
        } else {
            console.log("operation done!");
        }
    }
);
{
    error: false,
    operation: 'PNPushNotificationEnabledChannelsOperation',
    statusCode: 200
}

Go to MISCELLANEOUS