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
Bullety
Posts: 138
Registered: ‎08-02-2009
My Device: Z10
My Carrier: T-Mobile
Accepted Solution

Registration for Clients

Dear,

 

I am wondering if the registration for a push application can only be done via the server which initiates pushes or only via the BlackBerry device running the application which receives the pushes or both?

 

If also (or only) via the server, what's the registration url for a device pin if the base url is https://pushapi.eval.blackberry.com ?

 

Thanks in advance,

 

 

Best regards,

Bullety

Please use plain text.
Developer
Bullety
Posts: 138
Registered: ‎08-02-2009
My Device: Z10
My Carrier: T-Mobile

Re: Registration for Clients

Hi,

 

I got a bit further.

 

My subscribtion url is now:

https://pushapi.eval.blackberry.com/mss/PD_cpSub?cpAction=register&pin=00000000&appid=000-0000000000...

 

But I always get an rc=10011 error when opening this url...

 

This error means that osversion or model is null or empty or longer than 40 characters...

 

Does anyone knows something what could be wrong?

Please use plain text.
BlackBerry Development Advisor (Retired)
psapra
Posts: 74
Registered: ‎07-22-2008
My Device: BlackBerry Z10
My Carrier: N/A

Re: Registration for Clients

Registration can only be initated from the device.   Please see the deviceside sample application that includes sample code for registration.  This application is included with the BlackBerry Push Service SDK available at: http://na.blackberry.com/eng/developers/javaappdev/pushapi.jsp

 

 

Thanks,
Pratik Sapra
Gaming & Apps Consultant
Developer Relations
@pratiksapra
Please use plain text.
Developer
Bullety
Posts: 138
Registered: ‎08-02-2009
My Device: Z10
My Carrier: T-Mobile

Re: Registration for Clients

...But the registration in this sample (sample-client-app) calls the "contentProviderUrl" defined in the PushConfig.java and not the "bpasUrl".

 

I think the contentProviderUrl is the Url from my website which handles the registration etc?

Please use plain text.
BlackBerry Development Advisor (Retired)
psapra
Posts: 74
Registered: ‎07-22-2008
My Device: BlackBerry Z10
My Carrier: N/A

Re: Registration for Clients

contentProviderUrl is for Content Provider registration.  This registration process is seperate from registeration with the BlackBerry Push Service and it's upto your server application on how to manage it.

Thanks,
Pratik Sapra
Gaming & Apps Consultant
Developer Relations
@pratiksapra
Please use plain text.
Developer
Bullety
Posts: 138
Registered: ‎08-02-2009
My Device: Z10
My Carrier: T-Mobile

Re: Registration for Clients

Ok, thank you.

 

But the sample app only calls this content provider url.

 

So not the BlackBerry device registeres itself for the application at the push server but it registeres at the content provider server which registeres the device at the push server.

Is this correct?

 

That's the way the sample app is working I think.

 

But I want not to use java on the server side - it's .net code.

 

Therefore I need the URL for registering a device with http post.

But mine mentioned above does not work.

 

Do you know what's wrong with the url?

Please use plain text.
Developer
Bullety
Posts: 138
Registered: ‎08-02-2009
My Device: Z10
My Carrier: T-Mobile

Re: Registration for Clients

Is there anyone who got the debug portal and the sample app running in the tomcat who could possibly check which url is accessed when registering a new device to an application using the sample-app and the sample-client-app (possibly with wireshark or something similar)?

 

I do unfortunately not get it running so I can unfortunately not do it myself.

 

I always get these errors:

 

SCHWERWIEGEND: Error listenerStart
18.04.2010 16:43:36 org.apache.catalina.core.StandardContext start
SCHWERWIEGEND: Context [/debug-portal] startup failed due to previous errors
log4j:ERROR LogMananger.repositorySelector was null likely due to error in class
 reloading, using NOPLoggerRepository.

 

 

 

when I try to start tomcat...it's really frustrating to hang on one "simple" url... :smileywink:

 

It would be great if someone could try this for me.

 

 

I am planning to make and post an explanation of a very simple push application (with code snippets) on my blog when I get it running to help new developers and to prevent them from such problems we currently have here in the forums.

Please use plain text.
Developer
idonen
Posts: 43
Registered: ‎10-03-2008
My Device: Not Specified

Re: Registration for Clients

After the client sample app calls the content provider URL, assuming that doesn't fail, it then calls the bpasUrl server to register the device. This happens on lines 74/75 of PushController.java, which calls execute routine in RegisterCommand.java.

Please use plain text.
Developer
Bullety
Posts: 138
Registered: ‎08-02-2009
My Device: Z10
My Carrier: T-Mobile

Re: Registration for Clients

Dear idonen,

 

Thank you very much - I must have been blind...

 

I now see where it tries to register with the BPAS but I run into problems when the simulator or the device tries to register.

 

My PushLibFactory currently looks like this:

 

 

public class PushLibFactory {

	private static Object lib;

	static {
		lib = new PushLib50();
	}

	public static UiApplication getUiApplication() {
		return (UiApplication) lib;
	}

	public static BpasProtocol getBpasProtocol() {
		return (BpasProtocol) lib;
	}

	public static PushMessageListener getPushMessageListener() {
		return (PushMessageListener) lib;
	}

 

 

But always when the line in the static block is called (when an instance should be made), the program runs into a freeze and the method getBpasProtocol() will never be executed as defined in the RegisterCommand class:

 

 

		BpasProtocol bpasProtocol = PushLibFactory.getBpasProtocol();
		bpasProtocol.register(tx);

 

 

also then the bpasProtocol.register(tx) will never be executed because the Thread seems to have freezed while in the static block.

 

I already tried to put an empty constructor in PushLib50 but it did not help.

 

 

 

Is this debuggable in the simulator or can it only be done on a real device?

 

On my real device, an unhandled exception is thrown when I try to register (I saw it in the event log).

 

 

Do you know if it is normal that this bpasProtocol.register is never called?

Because the JavaDoc of PushLib50 says it registeres itself with the BPAS. Possibly bpasProtocol.register(tx) is not necessary in this case?!

Please use plain text.
Developer
Bullety
Posts: 138
Registered: ‎08-02-2009
My Device: Z10
My Carrier: T-Mobile

Re: Registration for Clients

[ Edited ]

I now got it...

 

The PushLib50 was extending UiApplication and my main application, too.

 

Therefore I think they were stealing each other the event dispatching thread.

 

 

So I now made my main application not UiApplication and it works now.

 

 

Thank you all for your help!

Please use plain text.