AndroidAndroid 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 Android V4 SDK
  1. ParameterTypeRequiredDefaultsDescription
    pushTypePNPushTypeYesNot setAccepted values: PNPushType.GCM, PNPushType.APNS, PNPushType.MPNS.
    channelsArraysYesAdd push notifications on the specified channels.
    deviceIdStringYesDevice id.
    asyncPNCallbackYesPNCallback of type PNPushAddChannelResult.
pubnub.addPushNotificationsOnChannels()
	.pushType(PNPushType.GCM)
	.channels(Arrays.asList("ch1", "ch2", "ch3"))
	.deviceId("googleDevice")
	.async(new PNCallback<PNPushAddChannelResult>() {
		@Override
		public void onResponse(PNPushAddChannelResult result, PNStatus status) {
			// handle response.
		}
	});
The addPushNotificationsOnChannels() does not return actionable data, be sure to check the status object on the outcome of the operation by checking the status.isError().
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 Android V4 SDK
  1. ParameterTypeRequiredDefaultsDescription
    deviceIdStringYesDevice id.
    pushTypePNPushTypeYesNot setAccepted values: PNPushType.GCM, PNPushType.APNS, PNPushType.MPNS.
    asyncPNCallbackYesPNCallback of type PNPushListProvisionsResult.
pubnub.auditPushChannelProvisions()
	.deviceId("googleDevice")
	.pushType(PNPushType.GCM)
	.async(new PNCallback<PNPushListProvisionsResult>() {
		@Override
		public void onResponse(PNPushListProvisionsResult result, PNStatus status) {
		
		}
	});
The auditPushChannelProvisions() operation returns a PNPushListProvisionsResult which contains the following operations:
MethodTypeDescription
getChannels() List<String>List of channels subscribed for push notifications.
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 Android V4 SDK
  1. ParameterTypeRequiredDefaultsDescription
    deviceIdStringYesDevice id.
    channelsArraysYesRemove push notifications on the specified channels.
    pushTypePNPushTypeYesNot setAccepted values: PNPushType.GCM, PNPushType.APNS, PNPushType.MPNS.
    asyncPNCallbackYesPNCallback of type PNPushRemoveChannelResult.
pubnub.removePushNotificationsFromChannels()
	.deviceId("googleDevice")
	.channels(Arrays.asList("ch1", "ch2", "ch3"))
	.pushType(PNPushType.GCM)
	.async(new PNCallback<PNPushRemoveChannelResult>() {
		@Override
		public void onResponse(PNPushRemoveChannelResult result, PNStatus status) {
		
		}
	});
The removePushNotificationsFromChannels() does not return actionable data, be sure to check the status object on the outcome of the operation by checking the status.isError().
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 Android V4 SDK
  1. ParameterTypeRequiredDefaultsDescription
    deviceIdStringYesDevice id.
    pushTypePNPushTypeYesNot setAccepted values: PNPushType.GCM, PNPushType.APNS, PNPushType.MPNS.
    asyncPNCallbackYesPNCallback of type PNPushRemoveAllChannelsResult.
pubnub.removeAllPushNotificationsFromDeviceWithPushToken()
    .deviceId("googleDevice")
    .pushType(PNPushType.MPNS)
    .async(new PNCallback<PNPushRemoveAllChannelsResult>() {
        @Override
        public void onResponse(PNPushRemoveAllChannelsResult result, PNStatus status) {
            
        }
    });
The removeAllPushNotificationsFromDeviceWithPushToken() does not return actionable data, be sure to check the status object on the outcome of the operation by checking the status.isError().

Go to Objects (BETA)