SelectBlackBerry Channel Groups API Reference for Realtime Apps

 

This SDK has been deprecated.

If you have questions about the PubNub for BlackBerry SDK, please contact us at support@pubnub.com.

Channel Groups allows PubNub developers to bundle thousands of channels into a group that can be identified by name. These Channel Groups can then be subscribed to, receiving data from the many backend-channels the channel group contains.

Learn more about our Channel Groups here


Requires Stream Controller add-on XRequires that the Stream Controller 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.
This function adds a channel to a channel group.
Adding Channels is accomplished by using the following method(s) in the BlackBerry SDK:
  1. ParameterTypeRequiredDescription
    groupStringYesThe channelGroup to add the channels to.
    channelsString[]YesThe channel to add to the channel group.
    callbackCallbackYesCallback object which contains callbacks for success, error etc.
  2. ParameterTypeRequiredDescription
    groupStringYesThe channelGroup to add the channels to.
    channelStringYesThe channel to add to the channel group.
    callbackCallbackYesCallback object which contains callbacks for success, error etc.
 String channelGroup = "family";
String channel = "wife"; 
pubnub.channelGroupAddChannel(channelGroup, channel, cb);
{
    "service" : "channel-registry",
    "status"  : 200,
    "error"   : false,
    "message" : "OK"
}

Requires Stream Controller add-on XRequires that the Stream Controller 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.
This function lists all the channels of the channel group.
Listing Channels is accomplished by using the following method(s) in the BlackBerry SDK:
  1. ParameterTypeRequiredDescription
    groupStringYesChannel group to fetch the channels of.
    callbackCallbackYesCallback object which contains callbacks for success, error etc.
 String channelGroup = "family";
 pubnub.channelGroupListChannels(channelGroup,  new Callback() {
            @Override
            public void successCallback(String channel, Object message) {
                notifyUser("(CHANNEL GROUP) LIST CHANNELS  : " + message);
            }

            @Override
            public void errorCallback(String channel, PubnubError error) {
                notifyUser("(CHANNEL GROUP) LIST CHANNELS  : " + error);
            }
        });

{
	"status" : 200,
	"payload" : {
		"channels" : ["hi"], 
		"group" : "abcd"
	},
	"service" : "channel-registry",
	"error" : False
}

Requires Stream Controller add-on XRequires that the Stream Controller 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.
This function removes the channels from the channel group.
Removing Channels is accomplished by using the following method(s) in the BlackBerry SDK:
  1. ParameterTypeRequiredDescription
    group StringYesSpecifies channelGroup to remove the channels from.
    channelsString[]YesThe channels to remove from the channel group.
    callbackCallbackYesCallback object which contains callbacks for success, error etc.
  2. ParameterTypeRequiredDescription
    group StringYesSpecifies channelGroup to remove the channels from.
    channelStringYesThe channel to remove from the channel group.
    callbackCallbackYesCallback object which contains callbacks for success, error etc.
Removing channels :
 String channelGroup = "family";
 Callback cb = new Callback() {
   @Override
   public void successCallback(String channel, Object message) {
     //notifyUser("REMOVE CHANNEL : " + message);
   }
 
   @Override
   public void errorCallback(String channel, PubnubError error) {
     //notifyUser("REMOVE CHANNEL : " + error);
   }
 };
 
 String channel = "son";
 String groupName = "channelGroup";
 
 pubnub.channelGroupRemoveChannel(groupName, channel, cb);

{
	"status" : 200,
	"message" : "OK",
	"service" : "channel-registry",
	"error" : False
}

Requires Stream Controller add-on XRequires that the Stream Controller 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.
This function removes the channel group.
Deleting Channel Group is accomplished by using the following method(s) in the BlackBerry SDK:
  1. ParameterTypeRequiredDescription
    group StringYesSpecifies channelGroup to remove.
    callbackCallbackYesCallback object which contains callbacks for success, error etc.
Deleting Channel Group :
 String channelGroup = "family";
pubnub.channelGroupRemoveGroup(channelGroup, new Callback() {});

{
	"status" : 200,
	"message" : "OK",
	"service" : "channel-registry",
	"error" : False
}