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
Developer
Posts: 230
Registered: ‎01-12-2013
My Device: z30
My Carrier: Mobile Vikings
Accepted Solution

BB10 how to post to pushapi

[ Edited ]

Dear Developers

 

I am trying to create a nodejs library to push stuff to a BB10 device. But it seems harder then expected and I don't find the documentation very usefull.

 

How do I see it?

1) My application asks the PushService for a token. The application gets a token back and sends the token to my NodeJS server. Right?

2) Because my server now knows the token of the device, he can send push messages to it by posting data to the PushService.

 

But how to post that data to the PushService? 

 

I got this url from by registering with BlackBerry:

https://cpXXX.pushapi.eval.blackberry.com

 

I changed the XXX to my own personal Content Provider ID. When I try to post something to that url with basic authentication, the server returns a 404 not found. Is the url corrupt or is it something I'm missing?

 

______________________________________________________
BB10-OAuth: GitHub
Retired
Posts: 311
Registered: ‎08-08-2012
My Device: BlackBerry Z10
My Carrier: Rogers

Re: BB10 how to post to pushapi

Hi,

 

Are you using WebWorks to develop your application on the device?

 

There are developer guides to help you in that regard found here:

https://developer.blackberry.com/devzone/develop/platform_services/push_apps.html

 

How are you trying to send out the push itself?  You need to use PAP XML in your post.  And, it does use basic authentication so it should not be giving you a 404 error if you are hitting the correct URL.  What happens when you try to hit the URL through the browser?

 

We offer a Push Service SDK to help develop a Push Initiator to send out pushes, but that is written in Java so I'm not sure if it meets your needs.  There are other developers out there using other languages for their Push Initiator so you might have to look around.

 

Matt

Developer
Posts: 230
Registered: ‎01-12-2013
My Device: z30
My Carrier: Mobile Vikings

Re: BB10 how to post to pushapi

Hi Matt

 

No I am using Cascades to do that. When I browse to the URL provided by blackberry (https://cpXXX.pushapi.eval.blackberry.com) and I change the XXX to my 4 digit CPID, I also get a 404 not found response. Should I mail them because it seems that the url provided, or my CPID is not correct...

 

Thanks

______________________________________________________
BB10-OAuth: GitHub
Retired
Posts: 311
Registered: ‎08-08-2012
My Device: BlackBerry Z10
My Carrier: Rogers

Re: BB10 how to post to pushapi

Just to compare, what happens when you hit the general URL from your browser?

https://pushapi.eval.blackberry.com

Or, you could send me a private message with your exact URL and I can try from my browser.

 

Thanks,

 

Matt

 

Developer
Posts: 230
Registered: ‎01-12-2013
My Device: z30
My Carrier: Mobile Vikings

Re: BB10 how to post to pushapi

I got a 404 on that url. What do you got?

______________________________________________________
BB10-OAuth: GitHub
Retired
Posts: 311
Registered: ‎08-08-2012
My Device: BlackBerry Z10
My Carrier: Rogers

Re: BB10 how to post to pushapi

It shows a blank page, but it goes to the URL no problem.

Developer
Posts: 230
Registered: ‎01-12-2013
My Device: z30
My Carrier: Mobile Vikings

Re: BB10 how to post to pushapi

If you are using chrome and you go to network, you will see that it's a 404. I also have a blank page, but I guess on https, a 404 just returns a blank page...

 

Really really weird stuff...

______________________________________________________
BB10-OAuth: GitHub
Retired
Posts: 311
Registered: ‎08-08-2012
My Device: BlackBerry Z10
My Carrier: Rogers

Re: BB10 how to post to pushapi

Yes, you're right.  I've never really noticed.  But, your own specific PPG URL should be fine.

Remember to use http when registering from your app on the BlackBerry itself.

And, use the https version when sending out pushes.

Developer
Posts: 230
Registered: ‎01-12-2013
My Device: z30
My Carrier: Mobile Vikings

Re: BB10 how to post to pushapi

[ Edited ]

I try to send a push message to the https url but without any luck. This is the body of the message

 

--PMasdfglkjhqwert
Content-Type: application/xml; charset=UTF-8

<?xml version="1.0"?>
<!DOCTYPE pap PUBLIC "-//WAPFORUM//DTD PAP 2.1//EN" "http://www.openmobilealliance.org/tech/DTD/pap_2.1.dtd">
<pap>
	<push-message push-id="1366197948976" source-reference="APPLICATION_ID">
		<address address-value="DEVICE_TOKEN" />
		<quality-of-service delivery-method="unconfirmed" />
	</push-message>
</pap>
--PMasdfglkjhqwert
Content-Encoding: binary
Content-Type: text/html
Push-Message-ID: 1366197948976

test

--PMasdfglkjhqwert--

 I send this to my PPG URL on port 443 (https). Is this correct?

https://cpXXX.pushapi.eval.blackberry.com

 Where I change the XXX to my personal CPID number. I use the following headers

Content-Type: multipart/related; boundary=PMasdfglkjhqwert; type=application/xml
Authorization: Basic AUTH_TOKEN

Am I missing something?

 

 

 

______________________________________________________
BB10-OAuth: GitHub
Retired
Posts: 311
Registered: ‎08-08-2012
My Device: BlackBerry Z10
My Carrier: Rogers

Re: BB10 how to post to pushapi

When you send a push you need to send it to more than just the base PPG URL.

 

You send it to:

https://cpXXX.pushapi.eval.blackberry.com/mss/PD_pushRequest

 

Matt