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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Highlighted
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