Welcome to the Official BlackBerry® Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

BlackBerry Push Development

Reply
Contributor
peterdeka
Posts: 39
Registered: 04-06-2011
My Carrier: Vodafone italy

Re: PushApplication interface and normal app operation

tried everything, installed another os, factory reset....there is no IT policy...but the firewall keeps blocking the pushes...is there a reason? (app has full permissions set by hand)

Please use plain text.
Contributor
BBDeveloper_D
Posts: 13
Registered: 10-12-2011
My Carrier: Etisalat

Re: PushApplication interface and normal app operation

[ Edited ]

Hi ekke,

I am currently working on BlackBerry push notification.In my client application the onMessage() method is not getting called but whenever I send push message from server my device is showing network interaction.Can you please help me in this and also can you please share some sample codes which implements PushApplication

Please use plain text.
Contributor
pablo_ivan57
Posts: 37
Registered: 02-24-2011

Re: PushApplication interface and normal app operation

Hi, I have the same need right now, my application isn't launching automatically when receiving push messages from the server. I know the server is sending them correctly because of the 200 ok status, and because I have another apps that constantly check in background for any new message. However the Application that implements PushApplication is not launched and even the onMessage method is never fired. Do you have any example of how to implement the PushApplication interface ?. Do I need any additional entry point?. The code I have right now looks like this:

 

package com.bes.push.example2;

import javax.microedition.io.StreamConnection;

import net.rim.blackberry.api.push.PushApplication;
import net.rim.blackberry.api.push.PushApplicationDescriptor;
import net.rim.blackberry.api.push.PushApplicationRegistry;
import net.rim.blackberry.api.push.PushApplicationStatus;
import net.rim.device.api.io.http.PushInputStream;
import net.rim.device.api.system.ApplicationDescriptor;
import net.rim.device.api.ui.UiApplication;

/**
 * This class extends the UiApplication class, providing a
 * graphical user interface.
 */
public class BESApplication extends UiApplication implements PushApplication
{
    /**
     * Entry point for application
     * @param args Command line arguments (not used)
     */ 
    public static void main(String[] args)
    {
        // Create a new instance of the application and make the currently
        // running thread the application's event dispatch thread.
        BESApplication theApp = new BESApplication();       
       	theApp.enterEventDispatcher();
        	 ApplicationDescriptor descriptor = ApplicationDescriptor
                     .currentApplicationDescriptor();
             ApplicationDescriptor pushDescriptor = new ApplicationDescriptor(
                     descriptor, new String[] { "push" });
             PushApplicationDescriptor registeredDescriptor = new 
                     PushApplicationDescriptor(4242, pushDescriptor);
             PushApplicationRegistry
                     .registerApplication(registeredDescriptor);
  
    }
    

    /**
     * Creates a new MyApp object
     */
    public BESApplication()
    {        
        // Push a screen onto the UI stack for rendering.
        pushScreen(new BESScreen());
    }


	public void onMessage(PushInputStream inputStream, StreamConnection conn) {
		System.out.println("ON MESSAGE");
		
	}


	public void onStatusChange(PushApplicationStatus status) {
		// TODO Auto-generated method stub
		
	}    
}

 

Please use plain text.
Regular Contributor
gunar_dev
Posts: 54
Registered: 09-22-2010

Re: PushApplication interface and normal app operation

@pablo:

The documentation for enterEventDispatcher is clear: 

Enters the event dispatcher.

The thread that calls this method (typically the main thread in the application) becomes the event-dispatching thread, which will execute all drawing and event-handling code.

Note that under normal circumstances this method does not return.  

 

I think you should check if the application is in the background or not and use that info

 

Please use plain text.