在尝试创建混合Android应用程序时不要初始化 [英] push not initilizing when trying to create hybrid android application

查看:301
本文介绍了在尝试创建混合Android应用程序时不要初始化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用bluemix和mobilefirst实现推送通知。我使用以下链接实现





  1. 对于秘密导航到移动应用程序安全性仪表板来自右侧的链接,您的秘密将显示在该页面上。


    I am trying to implement push notifications using bluemix and mobilefirst. I have used the following links to implement

    1. http://www.ibm.com/developerworks/library/mo-cordova-push-app/
    2. http://mbaas-gettingstarted.ng.bluemix.net/hybrid#initialize-push -

    When i run the the below code I am getting the following message in the console:

    initPush called---------------- main.js:29 calling bluemix initialize with values---------------------- IBMBluemixHybrid.js:2956 [INFO] [DEFAULT] Hybrid initialize ["applicationid","applicationsecret","applicationroute"]

    I neither see the device details reflected in the bluemix registered list. Can you please help me on this ?

    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);
               }); 
    

    解决方案

    You need to replace "applicationId", "applicationRoute", and "applicationSecret" in the code

    var values = {
            applicationId:"applicationId",
            applicationRoute:"applicationRoute",
            applicationSecret:"applicationSecret"
        };
    

    with those obtained from your Bluemix backend application.

    From the bluemix dashboard for your application click mobile options in the top right to see your ID and Route.

    For the secret navigate to the Mobile Application Security dashboard from the link on the right, and your secret will be displayed on that page.

    这篇关于在尝试创建混合Android应用程序时不要初始化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆