Initialize Pushbots on Enyo

edited September 2015 in General
Hi there, im using Enyo and cordova along with the Pushbots plugins. In the example, there is a index.js where you declare

onDeviceReady: function() {
app.receivedEvent('deviceready');
PushbotsPlugin.initialize("560ac569177959216b8b456b");
},

The problem is that i dont know how to do this in Enyo, or where to put it ? any guidance is very appreciate it.

Comments

  • Add a Signals component to your application's components block:
    components:[
    		{kind: "Signals", ondeviceready: "deviceready"},
    		// Other application components ...
    		]}
    	],
    And then put the call to the initialize function inside your deviceready function:
    deviceready: function() {
    		PushbotsPlugin.initialize("560ac569177959216b8b456b");
    	},
  • thanks a lot for your quick response. im not sure whats wrong or whats missing
    i got this, and for some reason it doesnt go inside the deviceReady, i have emulated on Riddle, and i was expection to the background the change color, it only changes when i click the button.

    enyo.kind({ name: "Push_App", components: [ { kind: "Button", content: "Click", ontap: "tapped" }, {kind: "Signals", ondeviceready: "deviceReady"}, {name: "label", content: "Hello, World!"}, ], deviceReady: function() { PushbotsPlugin.initialize("560ac569177959213b8b456b"); this.$.label.applyStyle("background-color", "yellow"); console.log("Device is ready"); alert("Device is ready"); }, tapped: function(inSender, inEvent) { this.$.label.applyStyle("background-color", "green"); } });


    and i just renderet in the HTML as


    var ssoSplash = new Push_App(); ssoSplash.renderInto(document.body);


    Im trying to use Pushbots but sitll can get to inizialize that variable. Any idea?
  • Hmmm... Are you sure PhoneGap/Cordova is being included in your project?
  • yes i supposed, i even compile it with CLI "cordova build android"
  • What i usually do is to create a project with

    cordova create hello2 com.example.hello HelloWorld

    then i replace the www with my own code that works on Enyo, did i miss something ?
  • It's been a while since I've created a PhoneGap app, but that looks right to me. Maybe try running it through PhoneGap Build to help narrow down where the issue is?
Sign In or Register to comment.