JavaScriptTitaniumTitaniumNode.jsPhoneGapReactVueWebTitanium V4 Mobile Push API Reference for Realtime Apps

PubNub's Mobile Push Gateway feature enables developers to bridge native PubNub publishing with 3rd-party push notification services including Google Android GCM (Google Cloud Messaging)/FCM (Firebase Cloud Messaging), Apple iOS APNS (Apple Push Notification Service), and Microsoft Windows Phone MPNS (Microsoft Push Notification Service).

By using the Mobile Push Gateway, developers can eliminate the need for developing, configuring, and maintaining additional server-side components for 3rd-party push notification providers.

Learn more about our Mobile Push Gateway here.


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 Titanium 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: ['my_chat'],
        device: 'A655FBA9931AB',
        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 Titanium 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: 'A655FBA9931AB',
        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 Titanium 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: ['my_chat'],
        device: 'A655FBA9931AB',
        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 Titanium 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: 'A655FBA9931AB',
        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
}