Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

BlackBerry Push Development

Reply
New Contributor
valera
Posts: 8
Registered: ‎03-30-2010
My Device: BlackBerry Stor 9530
My Carrier: developer
Accepted Solution

Sending push notification to some specific devices

Hi, guys!

 

I have to implement push notifications on client-side using net.rim.blackberry.api.push. As far as I understood, there is no way to pass some device- or user-specific data during registration (I mean registerApplication() in PushApplicationRegistry) so my push initiator won't be able to send notifications only to some specific devices, not to all registered with given app id. Is that right?

 

On the other hand, I know that using server-side library  net.rim.pushsdk  I can specify some addresses to which notification will be sent. They are stored in PushMessageControl instance which is passed to method net.rim.pushsdk.pap.PapServiceImpl.push() . Could you please explain me what these addresses are and how can I send them from client when registering for notifications?

 

Or maybe I'm totally lost in all this stuff...

 

Thanks in advance 

Please use plain text.
Developer
crispyoz
Posts: 223
Registered: ‎10-01-2011
My Device: Bold 9900

Re: Sending push notification to some specific devices

Hi Valera, 

 

Here is a simple code to push to BIS.

 

List<String> addresses = new ArrayList<String>();

addresses.add("27f45fc5");

PushMessageControl pushMessageControl = new PushMessageControl(idGenerator, APP_ID, addresses);
Content content = new TextContent(data);
PapService papService = new net.rim.pushsdk.pap.PapServiceImpl();
PushSDKProperties properties = getProperties();
HttpClientImpl client = new HttpClientImpl();
client.setPushSDKProperties(properties);
papService.setHttpClient(client);

papService.setPushSDKProperties(properties);
PushResponse response = papService.push(APP_ID, password, APP_ID,pushMessageControl, content);

 

Just add the PIN(s) you want to send to into the addresses list.

 

hth

 

Chris

Please use plain text.
New Contributor
valera
Posts: 8
Registered: ‎03-30-2010
My Device: BlackBerry Stor 9530
My Carrier: developer

Re: Sending push notification to some specific devices

Thanks a lot, Crispyoz!
Please use plain text.