3
votes

I'm with a difficult to use a Cordova plugin with Meteor and React, from the docs I saw that:

You should wrap any functionality which relies on a Cordova plugin in a Meteor.startup() block to make sure the plugin has been fully initialized (by listening to the deviceready event). For example, when using the Cordova geolocation plugin:

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

And I know I need to define this:

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

But I have some questions:

1º - Can I put this function Meteor.startup() anywhere inside server and about inside the client?

2º - Where I need to put the Cordova.depends()? There is a packages file on Meteor > local, but it's not a js file.

3º - After define the Cordova.depends() could I invoke the functions from the client side with react? If so, How?

Some example with that would be great!

1

1 Answers

1
votes

After sometime of research I found the answers:

1 - I already had the Meteor.startup(), it was inside the file main.js inside the client folder.

2 - I don't need to put the Cordova.depends(), according to the docs:

In contrast to Meteor packages, you’ll have to specify the exact version of the plugin. This can be a bit of a pain because you first need to look up what the most recent (compatible) version of a plugin is before you can add it.

3 - I can invoke the functions of Cordova plugins on the client or on the server, but I need to make that just with a native app, I'm making a webapp now, then I can't do that. But there is a way to do that with Meteor, following the Developing on device session.