How can I use Cordova with Meteor & React?

I'm having a hard time using the Cordova plugin with Meteor and React, from the docs I've seen:

You should wrap any functionality that relies on the Cordova plugin in a Meteor.startup () block to ensure that the plugin is fully initialized (by listening for the deviceready event). For example, when using the Cordoba geolocation plugin:

Meteor.startup(function() {
    // Here we can be sure the plugin has been initialized
    navigator.geolocation.getCurrentPosition(success); });
}
      

Run codeHide result


And I know that I need to define this:

Cordova.depends({
    'org.apache.cordova.camera': '0.3.1'
});
      

Run codeHide result


But I have several questions:

1ΒΊ - Can I put this function Meteor.startup()

anywhere inside the server and inside the client?

2ΒΊ - Where do I need to deliver Cordova.depends()

? There is a packages file at Meteor> local, but it is not a js file.

3ΒΊ - Once defined, Cordova.depends()

can I call client-side functions to react? If so, How?

Some example of this would be great!

+3


source to share


1 answer


After some research, I found the answers:

1 - I already had it Meteor.startup()

, it was inside the main.js file inside the client folder.

2 - I don't need to put Cordova.depends()

as per the docs :



Unlike Meteor packages, you must specify the exact version of the plugin. This can be a bit of a pain because you first need to see what is the most recent (compatible) version of the plugin before you can add it.

3 - I can call Cordova plugin functions on client or server, but I need to do it with my own application, now I am doing a webapp and then I cannot do it. But there is a way to do it with Meteor by following Development on Device .

+1


source







All Articles