javascript - Where should I code cordova's onDeviceReady function in meteor? -


i doing meteor mobile app android. installed this plugin meteor add cordova:org.jboss.aerogear.cordova.oauth2@1.0.3. want run ondeviceready function. tried function in both meteor.iscordova , meteor.startup. doesn't work. don't know weather approach right? , should code?

if (meteor.iscordova) {   oauth2.addfacebook({     name: 'facebook',     settings: {       clientid: '1511044619160050',       clientsecret: '3b08052d3d96e2120f2c53a36eebd02f',       scopes: 'photo_upload, publish_actions'     }   }); } 

referenceerror: oauth2 not defined

you can use meteor.startup:

meteor.startup(function() {   if (meteor.iscordova) {     oauth2.addfacebook({       name: 'facebook',         settings: {           clientid: '1511044619160050',           clientsecret: '3b08052d3d96e2120f2c53a36eebd02f',           scopes: 'photo_upload, publish_actions'         }      });    } }); 

from: https://github.com/meteor/meteor/wiki/meteor-cordova-phonegap-integration

any functionality relies on cordova/phonegap plugin should wrap code in meteor.startup() block.

while not mentioned explicitly, fires after ondeviceready event. verified in meteor source @ https://github.com/meteor/meteor/blob/29194cef83d418227a8cc43e41b1539b13a6b68a/packages/meteor/startup_client.js#l12-l27


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -