Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
blackberry webworks推送演示与城市飞艇配合使用所需的帮助_Blackberry_Push_Blackberry Webworks - Fatal编程技术网

blackberry webworks推送演示与城市飞艇配合使用所需的帮助

blackberry webworks推送演示与城市飞艇配合使用所需的帮助,blackberry,push,blackberry-webworks,Blackberry,Push,Blackberry Webworks,我已经得到了推送演示在模拟器中工作 当我在带有UrbanAirship测试推送消息的blackberry设备(blackberry Bold 9000)上试用时,我无法收到任何推送通知 到目前为止,我所做的工作包括: *将推送端口从100更改为29580 *将应用程序id作为属性添加到config.xml中的小部件元素中 *该应用程序在上传到手机之前已签名。 *我假设代码中没有错误,因为启动/停止订阅警报消息都显示在应用程序启动/按钮单击上 *当UrbanAirship发送测试消息时,没有网络活

我已经得到了推送演示在模拟器中工作

当我在带有UrbanAirship测试推送消息的blackberry设备(blackberry Bold 9000)上试用时,我无法收到任何推送通知

到目前为止,我所做的工作包括: *将推送端口从100更改为29580 *将应用程序id作为属性添加到config.xml中的小部件元素中 *该应用程序在上传到手机之前已签名。 *我假设代码中没有错误,因为启动/停止订阅警报消息都显示在应用程序启动/按钮单击上 *当UrbanAirship发送测试消息时,没有网络活动的迹象

我的config.xml文件如下所示:

<?xml version="1.0" encoding="utf-8"?>
<widget xmlns:rim="http://www.blackberry.com/ns/widgets" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" id="{app_id}">
    <name>Push Example</name>
    <description>Samples of code</description>
    <author href="http://www.rim.com/" rim:copyright="no copyright" email="webapi@rim.com">
    Research in Motion - Web API Team
    </author><content src="index.htm" />
    <feature id="blackberry.system" required="true" version="1.0.0.0" />
    <feature id="blackberry.app" required="true" version="1.0.0.0" />
    <feature id="blackberry.invoke.JavaArguments" required="true" version="1.0.0.0" />
    <feature id="blackberry.invoke.CalendarArguments" required="true" version="1.0.0.0" />
    <feature id="blackberry.invoke" required="true" version="1.0.0.0" />
    <feature id="blackberry.push" version="1.0.0"/>
    <feature id="blackberry.identity" version="1.0.0"/>
    <feature id="blackberry.utils" required="true" version="1.0.0.0" />
    <rim:connection timeout="30000">
        <id>MDS</id>
        <id>BIS-B</id>
        <id>TCP_WIFI</id>
        <id>TCP_CELLULAR</id>
        <id>WAP2</id>
        <id>WAP</id>
    </rim:connection>
    <license href="http://www.license.com">This is a sample license</license>
</widget>
//the port that the Push Listener will listen to on the MDS
//Open the rimpublic.property file, which is located in the MDS\config subdirectory
//of your BlackBerry Email and MDS Services Simulators installation directory.
//Ensure the "push.application.reliable.ports=100" line is NOT commented out.
var port = 29580;

function subscribe() {
    //open the listener to listen if there is pushed data coming through
    blackberry.push.openPushListener(handleReturnData, port);
    try {
        alert("push listening has started. push port = ("+port+") app id = (" + blackberry.app.id + ") pin = ("+blackberry.identity.PIN+")");
    } catch (e) {
        alert (e);
    }
}

//handleReturnData - the function to call for the event of pushed data coming through
//port - the port to listen on
function handleReturnData(data) {
    try {
        if (data != null) {
            var text = blackberry.utils.blobToString(data.payload);
            alert("text recieved from push: " + text);
        } else {
            alert("No data from the push");
        }
    } catch (e) {
        alert (e);
    }
}

function unsubscribe() {
    //stop listening for pushed data, a clean up step
    blackberry.push.closePushListener(port);
    alert("Push listening has stopped");
}
<html>
    <head>
        <title>Push Example</title>
        <script src="Scripts/action.js" type="text/javascript"></script>
        <link href="Styles/styles.css" rel="stylesheet" type="text/css" />
    </head>
    <body onload="javascript&colon;subscribe();">
        <button id="btnUnsubscribe" onclick="unsubscribe();">Unsubscribe</button>
    </body>
</html>
最后,我的index.html文件如下所示:

<?xml version="1.0" encoding="utf-8"?>
<widget xmlns:rim="http://www.blackberry.com/ns/widgets" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" id="{app_id}">
    <name>Push Example</name>
    <description>Samples of code</description>
    <author href="http://www.rim.com/" rim:copyright="no copyright" email="webapi@rim.com">
    Research in Motion - Web API Team
    </author><content src="index.htm" />
    <feature id="blackberry.system" required="true" version="1.0.0.0" />
    <feature id="blackberry.app" required="true" version="1.0.0.0" />
    <feature id="blackberry.invoke.JavaArguments" required="true" version="1.0.0.0" />
    <feature id="blackberry.invoke.CalendarArguments" required="true" version="1.0.0.0" />
    <feature id="blackberry.invoke" required="true" version="1.0.0.0" />
    <feature id="blackberry.push" version="1.0.0"/>
    <feature id="blackberry.identity" version="1.0.0"/>
    <feature id="blackberry.utils" required="true" version="1.0.0.0" />
    <rim:connection timeout="30000">
        <id>MDS</id>
        <id>BIS-B</id>
        <id>TCP_WIFI</id>
        <id>TCP_CELLULAR</id>
        <id>WAP2</id>
        <id>WAP</id>
    </rim:connection>
    <license href="http://www.license.com">This is a sample license</license>
</widget>
//the port that the Push Listener will listen to on the MDS
//Open the rimpublic.property file, which is located in the MDS\config subdirectory
//of your BlackBerry Email and MDS Services Simulators installation directory.
//Ensure the "push.application.reliable.ports=100" line is NOT commented out.
var port = 29580;

function subscribe() {
    //open the listener to listen if there is pushed data coming through
    blackberry.push.openPushListener(handleReturnData, port);
    try {
        alert("push listening has started. push port = ("+port+") app id = (" + blackberry.app.id + ") pin = ("+blackberry.identity.PIN+")");
    } catch (e) {
        alert (e);
    }
}

//handleReturnData - the function to call for the event of pushed data coming through
//port - the port to listen on
function handleReturnData(data) {
    try {
        if (data != null) {
            var text = blackberry.utils.blobToString(data.payload);
            alert("text recieved from push: " + text);
        } else {
            alert("No data from the push");
        }
    } catch (e) {
        alert (e);
    }
}

function unsubscribe() {
    //stop listening for pushed data, a clean up step
    blackberry.push.closePushListener(port);
    alert("Push listening has stopped");
}
<html>
    <head>
        <title>Push Example</title>
        <script src="Scripts/action.js" type="text/javascript"></script>
        <link href="Styles/styles.css" rel="stylesheet" type="text/css" />
    </head>
    <body onload="javascript&colon;subscribe();">
        <button id="btnUnsubscribe" onclick="unsubscribe();">Unsubscribe</button>
    </body>
</html>

举例说明
退订
有人知道我的代码/配置有什么问题吗

干杯, Stephen

可能重复的