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
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none
Accepted Solution

Use of push-id and payload id in BB10?

I'm fairly new to Push stuff so this may be covered elsewhere. I didn't find anything by searching the forums.

 

When sending the push, the PAP <push-message> contains a push-id attribute. This seems to be an arbitrary string that I can specify.

 

When receiving a push, the PushPayload instance has an id() which is also a string, documented as "Returns the push identifier.". It appears it may be set by the system and unrelated to anything in the push itself, and so far appears to be set to "<APPID>_<some-integer>".

 

Is there any relationship between these?

 

What's the purpose of the push-id attribute?  I'm doing "open loop" pushes through BIS with the basic Push service (not Push Plus), so my assumption is if I were using Push Plus or sending through BES10 it would be a useful identifier for querying the status of the push.

 

What's the purpose of the PushPayload id property, and if it's correct that the docs say it returns the "push identifier", then what is the push identifier and is there any connection to the push-id property above?

 

Thanks for any comments you may have.


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
BlackBerry Development Advisor (Retired)
gbeukeboom
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10
My Carrier: Bell

Re: Use of push-id and payload id in BB10?

Hi Peter,

 

What you're thinking makes sense however after getting a history lesson on the whole situation I found that this is essentially a bug. Really the push-id value should get passed in and be able to be read from the PushPayload#id field however the Push Server doesn't currently even pass this value down to the client. The push-id is useful today if you push through a BES or have Push Plus for querying the status of a push or canceling a push.

 

The field you read from PushPayload#id is actually generated automatically on the client if no Push ID is received, which is why it bears no resemblance to....anything useful.

 

There is a workaround! You can add this header to the push payload section of your server push 'Push-Message-ID', giving your payload a structure like:

--asdfglkjhqwert
Content-Type: text/plain
Push-Message-ID: <whateverIdYouWant/>

 

<payloadData/>
--asdfglkjhqwert--

 

I have tested this out and it works well, gives the expected value at the client side.

 

Garett
@garettBeuk
--
Goodbye everybody!
Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Use of push-id and payload id in BB10?

Thanks Garett, that's awesome!

I was hoping not to lose the (in my case) 21 bytes from the payload for the bit of header information I need to include in my pushes (basically sequence info, to let the client reassemble a larger blob of data), so this is good news. I also hate to see capabilities not used to their fullest. :-)

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Use of push-id and payload id in BB10?

I've been slogging along to find out exactly what's crucial, what's redundant, what's optional and what's going to make the whole thing blow up with BIS push and both types of BES10 push. There are lots of different little things... this stuff is pretty brittle.

 

Wow though.. this one takes the cake:

 

That header is case-sensitive!!!

 

If you try to use Push-Message-Id or push-message-id, this feature won't work.  Only the exact text "Push-Message-ID" works.

 

This is a straight bug, I think, since no such header should ever be case-sensitive, but consider this a warning for anyone else trying to use this feature.


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
BlackBerry Development Advisor (Retired)
gbeukeboom
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10
My Carrier: Bell

Re: Use of push-id and payload id in BB10?

My guess, the patch to allow this header to be passed through was not extensively tested so it could be added quickly. Once the Push ID of the actual push message (surrounding wrapper of the payload) is able to pass through it should fix this issue as well.

 

Definitely a facepalm-worthy moment

Garett
@garettBeuk
--
Goodbye everybody!
Please use plain text.