我正在尝试使用bluemix和mobilefirst实现推送通知。我使用以下链接来实现
当我运行以下代码时,我在控制台中收到以下消息:
initPush调用---------------- main.js:29调用bluemix初始化值---------------------- IBMBluemixHybrid.js:2956 [INFO] [DEFAULT]混合初始化[" applicationid"," applicationsecret"," applicationroute"]
我既没有看到bluemix注册列表中反映的设备详细信息。你能帮帮我吗?
var values = {
applicationId:"applicationId",
applicationRoute:"applicationRoute",
applicationSecret:"applicationSecret"
};
console.log("initPush called---------------------------------");
console.log("calling bluemix initialize with values--------------------------------");
IBMBluemix.initialize(values).then(function(status) {
console.log("IBM Bluemix Initialized", status);
return IBMPush.initializeService();
}, function (err) {
console.error("IBM Bluemix initialized failed" , err);
}).then(function(pushObj) {
function pushReceived(info) {
console.log("registerListener - " + info.alert);
alert('got a push message! ' + info.alert);
}
console.log("IBM Push Initialized", pushObj);
push = pushObj;
return push.registerDevice("LisaTest","Lisa123","pushReceived");
}, function (err) {
console.error("IBM Bluemix Push initialized failed" , err);
});
答案 0 :(得分:1)
您需要在代码中替换“applicationId”,“applicationRoute”和“applicationSecret”
var values = {
applicationId:"applicationId",
applicationRoute:"applicationRoute",
applicationSecret:"applicationSecret"
};
从您的Bluemix后端应用程序获得的那些。
在应用程序的bluemix仪表板中,单击右上角的移动选项以查看您的ID和路线。