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
Highlighted
Contributor
Posts: 10
Registered: ‎02-14-2013
My Device: BlackBerry Bold 9700
My Carrier: Vodafone
Accepted Solution

Getting device ID in the method BpsSubscriptionMessageBuilder.createByteSubscriptionMessage

Hi to all,


First, excuse me if this thread is not appropriated because there is a similar one. If there is, I have not found it.

I want to construct an push-enabled application with its server but i dont want to use the servlets and jar provided by the SDK push service.

I think the only thing I have to do in the server part is to mount the PAP message with the required parameter "address" (the device address) using low-level libraries.

However, i have a problem developing the application in the device. Using this code as reference:
http://docs.blackberry.com/en/developers/deliverables/21128/Subscribe_to_a_BPS_content_provider_1226...

I see that the parameter "address" is obtained in the method createByteSubscriptionMessage, but I cant see its implementation to obtain the parameter "address" (obtained in the subscription servlet) because it is a native method.

So,

1.- Seeing the API:

http://www.blackberry.com/developers/docs/7.0.0api/net/rim/device/api/io/messaging/BpsSubscriptionMe...

What is the parameter "address" obtained in the server part (subscription servlet)? The device ID? How i can retrieve it?

2.- Could I build the app-client  just staying in step 6 and send the HTTP message on my way?

Someone can help me??

Thx to all.
Regards.

Retired
Posts: 76
Registered: ‎08-08-2012
My Device: BlackBerry Z10
My Carrier: Rogers

Re: Getting device ID in the method BpsSubscriptionMessageBuilder.createByteSubscriptionMessage

If I understand what you are trying to ask is how to get the address of the device back to your server-side push initiator application.

 

If so, you can see an example here:

https://developer.blackberry.com/java/documentation/registering_to_receive_push_messages.html

 

Basically you can see the sample code for the sample push-enabled application constructs an HTTP message to send to it's server-side application. While this sample does send the HTTP message in the format the SDK expects you don't need to use the SDK or the same format but you can follow the example to send a simple HTTP message to your own server to pass the information your server-side app needs. For example, the link above shows that to get the device address you can do this:

 

Integer.toHexString( DeviceInfo.getDeviceId() )

 In your server-side application you should save that device address and then when you construct the push request message you use it as the device address if using the SDK low-level APIs (or insert that value in the address field of the PAP XML if not using the SDK).

 

Contributor
Posts: 10
Registered: ‎02-14-2013
My Device: BlackBerry Bold 9700
My Carrier: Vodafone

Re: Getting device ID in the method BpsSubscriptionMessageBuilder.createByteSubscriptionMessage

thanks you very much