Window.cordova undefined during USB android device testing


#1

Im not sure what im doing wrong but I cant get window.cordova.
I know you must be on a device so I am using my nexus 4 hooked up with USB.

Heres the code:

.run(function($ionicPlatform) {
  $ionicPlatform.ready(function() {
     console.log('this gets run');
     if(window.cordova){
       console.log('this does not run');
     }
   });
});

#2

are you sure cordova.js is included in index.html?


#3

This is my index.html, I have ngCordova included is that enough?

 !DOCTYPE html>
  <html>
    <head>
      <meta charset="utf-8">
      <meta content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width" name="viewport">
      <title>Ionic App</title>
      <script src="lib/lodash/lodash.min.js"></script>
      <script src="lib/jquery/dist/jquery.min.js"></script>
      <script src="lib/ionic/js/ionic.bundle.min.js"></script>
      <script src="lib/ngCordova/ng-cordova.min.js"></script>

      <script src="js/app.js"></script>
      <script src="js/controllers.js"></script>
      <script src="js/services.js"></script>
      <script src="js/filters.js"></script>
  
      <link rel="stylesheet" type="text/css" href="css/ionic.app.css">
      <link rel="stylesheet" type="text/css" href="lib/animate.css/animate.min.css">
    </head>
    <body ng-app="my_ionic_app">
       <ion-nav-view></ion-nav-view>
    </body>
 </html>

#4

no cordova.js must be included :wink: ng-cordova is just a wrapper around cordova.js and simplyfies things from cordova