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
Developer
Eugen
Posts: 371
Registered: 07-16-2009
My Carrier: Vodafone NL
Accepted Solution

PushApplication onMessage is called several times

Hi guys,

 

I contacted my BE team but during I'm waiting reply I want to ask the community:

 

Is your onMessage called several times with the same message?

 

I see in RIM examples code they check that this message is new (not proccesed yet):

    public static void process( PushInputStream pis, Connection conn ) {
        Logger.log( "Reading incoming push message ..." );

        try {

            HttpServerConnection httpConn;
            if( conn instanceof HttpServerConnection ) {
                httpConn = (HttpServerConnection) conn;
            } else {
                throw new IllegalArgumentException( "Can not process non-http pushes, expected HttpServerConnection but have "
                        + conn.getClass().getName() );
            }

            String msgId = httpConn.getHeaderField( MESSAGE_ID_HEADER );
            String msgType = httpConn.getType();
            String encoding = httpConn.getEncoding();

            Logger.log( "Message props: ID=" + msgId + ", Type=" + msgType + ", Encoding=" + encoding );
                        
            if( !alreadyReceived( msgId ) ) {
}
}

 

 

Do you have the same check in your app?

 

Thanks,

Eugen

Please use plain text.
Developer
massimo_olive
Posts: 234
Registered: 11-08-2010

Re: PushApplication onMessage is called several times

There is no guarantee that dups can be sent to the device but from my experience its quite rare. You'd have to add a message id to the http header when you push the message for it to work.

Please use plain text.