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

Web and WebWorks Development

Reply
New Contributor
Posts: 4
Registered: ‎07-17-2012
My Device: 9520
My Carrier: T-Mobile

Not receiving push message while in Background/App Close

I am using BIS push.

I receive push on my device while in foreground.  


But I dont receive any push on my device while in background/app close.  
 My client side code

var port = 21000;
var serverURL = "http://pushapi.na.blackberry.com";
var appID = "XXX-617k3e20yRDmXXXf316r70M4cc13202kXXXX";
var max = 100;
var wakeUpPage = "index.html";

 

I call listenToPush() in the init of my startup page for foreground app which is also index.html

 

function listenToPush() {
    try {
        var ops = {port : port, appId : appID, serverUrl : serverURL, wakeUpPage : wakeUpPage, maxQueueCap : max};
        blackberry.push.openBISPushListener(ops, onData, onRegister, onSimChange);
    } catch (e) {
        alert("Error starting BISPushListener: "+e);
    }     
}

function onData(data) {
    alert(data.payload);
    try {
        // Some code
        return 0; //indicate acceptance of payload for reliable push
    } catch (e) {
        alert("Error on receive BISPushListener: "+e);
    }
}

function onRegister(status) {
    if (status == 0) {
        alert("success");
    } else if (status == 1) {
        alert("network error");
    } else if (status == 2) {
        alert("rejected by server");
    } else if (status == 3) {
        alert("invalid parameters");
    } else if (status == -1) {
        alert("general error");
    } else {
        alert("unknown status");
    }
}

function onSimChange() {
    // Some code
}

 

====================================================================================

 

config.xml

 

<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:rim="http://www.blackberry.com/ns/widgets" version="1.0.0.0">
  <name>Name</name>
  <author rim:copyright="cpr"
              email="emaul"
              href="ref">name</author>
 
  <feature id="blackberry.invoke" required="true" />
  <feature id="blackberry.invoke.BrowserArguments" required="true" />
  <feature id="blackberry.push" required="true" />
  <feature id="blackberry.io.dir" required="true" />
  <feature id="blackberry.io.file" required="true" />
  <feature id="blackberry.utils" required="true" />
  <feature id="blackberry.identity" required="true" />
  <feature id="blackberry.system" required="true" />
  <feature id="blackberry.app" required="true" />
  <feature id="blackberry.app.event" required="true" />
  <feature id="blackberry.ui.menu" required="true" />

  <access subdomains="true" uri="the location"/>
  <access subdomains="true" uri="*"/>
  <access subdomains="true" uri="file:///"/>
 
  <icon rim:hover="false" src="images/icon.png"/>
  <icon rim:hover="true" src="images/icon.png"/>
 
  <content src="index.html" rim:allowInvokeParams="true">
    <rim:background src="index.html"/>
  </content>
 
  <rim:connection timeout="25000">
    <id>TCP_WIFI</id>
    <id>MDS</id>
    <id>BIS-B</id>
    <id>TCP_CELLULAR</id>
    <id>WAP2</id>
    <id>WAP</id>
  </rim:connection>
 
  <rim:loadingScreen foregroundImage="images/splash2.png" onFirstLaunch="true">
    <rim:transitionEffect type="zoomIn"/>
  </rim:loadingScreen>
</widget>

 

 

 

Thanks,
PLEASE HELP, BEEN STUCK AT THIS STAGE FOR AGES NOW