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
Posts: 4
Registered: ‎08-10-2011
My Device: Blackberry Curve
My Carrier: A1

Open Application or Notify User on Push Message

Hi,

 

I'm having some troubles with the push client implementation and I hope you can help me out. My application does receive push notifications when it's running in the foreground. But as soon as I close the app I'm don't seem to receive any push notifications anymore. The application is based on the official push sdk example.

 

That's what I'm doing in the onMessage method:

 

PushMain.switchScreen(PushMain.getAuthenticationScreen());     PushLibFactory.getUiApplication().requestForeground();

 

 

Here's the method switchScreen:

public static void switchScreen(final Screen nextScreen)
{
	final UiApplication ui = UiApplication.getUiApplication();
	final Screen currentScreen = ui.getActiveScreen();

	if(currentScreen != null)
	{
		if(currentScreen != nextScreen)
		{
			if (UiApplication.isEventDispatchThread())
			{
				ui.popScreen(currentScreen);
				ui.pushScreen(nextScreen);
			}
			else
			{
				ui.invokeLater(new Runnable()
				{
					public void run()
					{
						ui.popScreen(currentScreen);
						ui.pushScreen(nextScreen);
					}});
				}
			}
		}
		else
		{
			ui.pushScreen(nextScreen);
		}
}

 

Thanks!

Highlighted
Contributor
Posts: 24
Registered: ‎06-16-2011
My Device: Blackberry Z10
My Carrier: O2

Re: Open Application or Notify User on Push Message

I guess you need to first push it to fore ground and then switch the screen.

Change the order of instructions in onMessage method