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
Posts: 467
Registered: ‎07-16-2009
My Device: Z10 LE
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

Highlighted
Developer
Posts: 235
Registered: ‎11-08-2010
My Device: Not Specified

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.