$cordovaDatePicker not working after android build


#1

I have written an android app using Ionic. The app uses $cordovaDatePicker from the ngCordova website, and this works fine when I do ionic run android and install the app onto my phone.

The problem is if I run ionic build android, then install the apk from a website to test it in the real world, the datepicker doesn’t show at all. The function it’s in is being called fine, and if I console.log $cordovaDatePicker then I can see an object is output as I’d expect.

The function I am calling looks like this:

var options = {
    date: new Date(),
    mode: 'date'
};

$cordovaDatePicker.show(options).then(function(date) {
    $timeout(function() {
        scope.selectedDateTime = date;
    }, 50);
}, function(err) {
    alert(err);
});

I’ve tried adding every permission from this page and that still didn’t help. Because the datepicker window is never shown, neither the success or error callbacks are reached. Does anyone have any ideas?

Thanks for any help.

P.S. I have also posted this question on stackoverflow http://stackoverflow.com/questions/32737896/cordovadatepicker-not-working-after-android-build


#2

Got this working in the end by:

  1. Upgrading Ionic to the latest version via npm

  2. Removing the datepicker plugin (v0.8.1)

  3. Installing it again with the latest version (v 0.8.9)

Not sure what changed but it’s working OK now!