So I have added the cordovaarduino plugin using cordova plugin add cordovaarduino
and it resides in the plugins directory.
The project root directory
The www directory.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title></title>
<link href="lib/ionic/css/ionic.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
<link href="css/ionic.app.css" rel="stylesheet">
-->
<!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.js"></script>
<!-- cordova script (this will be a 404 during development) -->
<!--<script src="cordova.js"></script>-->
<!-- your app's js -->
<script src="js/app.js"></script>
</head>
<body ng-app="starter" ng-controller="hostController">
<div class="offline-outer-wrap">
<h2>Something Setup</h2>
<div class="offline-wrap">
<p>Something</p>
....
</div>
</div>
</body>
</html>
app.js
app.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if(window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if(window.StatusBar) {
StatusBar.styleDefault();
}
if(window.localStorage['host']){
window.open('file:///android_asset/www/app/offline/index.html#device/android','_self')
}
});
});
In the $ionicplatform.ready()
, window.cordova is not available nor am I able to access my plugin using the navigator object.
How can I access the plugin and what am I doing wrong?
EDIT: I uncommented the cordova.js import and now I am able to access the plugin, but when I start the app on the android device I am getting alert pop-ups like this : https://github.com/apache/cordova/issues/40. Why is this happening?