1
votes

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

1 Answers

1
votes

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.

enter image description here enter image description here

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. enter image description here