$cordovaDevice plugin not working in Ionic View App

I’ve installed ngCordova’s Device plugin

cordova plugin add cordova-plugin-device

But trying to access the device is not working from the Ionic View App. From the following code, nothing is alerting.

I’ve read from here that the cordova device plugin should be compatible with Ionic View. Have I missed something?

angular.module('myApp', ['ngCordova'])
    .run(function($ionicPlatform, $cordovaDevice) {
         $ionicPlatform.ready(function() {

maybe this one can help you out ;]

Yes that’s where I got the documentation for the device plugin. As it says on the page $cordovaDevice.getUUID() should return a string of the device’s UUID. It seems, at least in my situation, it doesn’t return anything in Ionic View.

I’ve just created a completely fresh project. I installed ngCordova and its Geolocation plugin and I got it to alert() my location in Ionic View. Worked fine. Then I installed ngCordova’s Device plugin. Trying to alert my UUID within Ionic View fails again.

Any ideas why it just seems that ngCordova’s Device plugin isn’t playing nicely with Ionic View? Has anyone had success with this?

Did u only try on Ionic serve ?

If yes, you can probably can see that device is not defined when you check console log on your browser(F12)
and this one might help you out,

Thanks, but I’m trying to get this to work with Ionic View, I know that cordovaDevice will not work in the desktop browser.

Similar issue with my app. Following link works fine for me. http://thejackalofjavascript.com/getting-started-with-ngcordova/

Thanks for the link, that’s a very thorough document. I’ll try it out and see if I can get it to work.

$ionicPlatform.ready(function() {        
         $scope.$apply(function() {            
                 // sometimes binding does not work! 
          var device = $cordovaDevice.getDevice();           

I think $scope.$apply is making a difference.

I am facing the same problem and is driving me nuts! Did someone solve this?

I’m having same problem with “Ionic View”. Has anyone tried with Facebook plugin? Note the OP is specifically referring to using the mobile app “Ionic View” on their device. Not ionic serve or anything local on their machine for development. This is a mobile app for previewing Ionic developed apps without having to install your application directly onto device but test it from the cloud. I could be wrong but I would guess Ionic View only supports the changes HTML JS content and anything native would have to be preinstalled with Ionic View. Geolocation and others that can use the HTML5 specs as fallback may still work but what about other Cordova plugins?