Struggling to incorporate a cordova plugin into my vue.js project using vue-cordova.
Specifically, I am attempting to utilize the open-native-settings plugin to access device settings on iOS or Android. While it works seamlessly in the demo app provided by vue-cordova on Github, integrating it into my own apps does not seem to trigger the expected event. To address this, I have attempted waiting for the event with:
Vue.cordova.on('deviceready', () => {
// within this block, checking for required variables
})
and also using:
document.addEventListener('deviceready', deviceReady, false);
Unfortunately, as the event fails to trigger, these approaches yield no results. I find myself unsure of how to proceed to ensure the event triggers so that I can successfully load my desired plugin. As a novice user in this area, I suspect there may be something crucial that I am overlooking.
UPDATE
When introducing vue-cordova into my main.js file, I employ the following technique:
import VueCordova from 'vue-cordova'
Vue.use(VueCordova, {
optionTestKey: 'optionTestValue'
})
Subsequently, when attempting to load the plugins in another view, my approach is as follows:
import Vue from 'vue'
// additional code here
mounted: function() {
this.cloudyConnection();
this.lastUpdateDate = this.getLastUpdateDate();
if (this.cordova.deviceready === true) {
this.onDeviceReady()
}
After experimentation both inside and outside of the mounted function, utilizing the listed function, I am still unable to achieve the desired outcome.
In addition, I have included
<script src="cordova.js"></script>
in www/index.html per instructions, yet this adjustment has not proved effective.
I extend my gratitude to all who have taken the time to assist me!