I am running into an issue while utilizing $cordovaLocalNotification within my ionic app where the below code yields an error message TypeError: Cannot read property 'local' of undefined
try{
if($scope.active.checked){
$cordovaLocalNotification.schedule({
id: 1,
title: 'Notification',
text: 'You are currently publishing your location.'
}).then(function(result){
AlertService.notify('Success', 'Successfully notified customer')
}, function(err){
AlertService.notify('Error', 'Failed to notify customer')
});
} else {
$cordovaLocalNotification.cancel(1);
}
}catch(err){
AlertService.notify('Issue', err)
}
So, after reading a few responses around needing to verify ionicPlatform.ready() and ensuring the plugin is installed properly (and verifying those aren't the issues), I am at a lost. I believe this issue is caused by cordova.plugins.notification not being defined, but I'm not sure why this plugin isn't being loaded properly.
From Ionic, I have the following plugins:
cordova-plugin-app-event 1.2.0 "Application Events"
cordova-plugin-camera 2.3.0 "Camera"
cordova-plugin-compat 1.0.0 "Compat"
cordova-plugin-console 1.0.4 "Console"
cordova-plugin-device 1.1.3 "Device"
cordova-plugin-geolocation 2.4.0 "Geolocation"
cordova-plugin-splashscreen 4.0.0 "Splashscreen"
cordova-plugin-statusbar 2.2.0 "StatusBar"
cordova-plugin-whitelist 1.3.0 "Whitelist"
de.appplant.cordova.plugin.local-notification 0.8.4 "LocalNotification"
ionic-plugin-keyboard 2.2.1 "Keyboard"
So far, for my own sanity, I have:
Also, a good item to note is I am utilizing ionicView to test. All/any help would be appreciated.
It turns out that mocking this on the emulator or physical device works fine. So it was a good learning experience that not all cordova plugins operate in ionicView