Good evening.
Can anyone help me with how to use CordovaLocalNotification?
I created a test button in the view with the function ng-click="testNotification ()"
And in my controller it looks like this:
.controller ('ListController', function ($ scope, $ rootScope, $ ionicPlatform, $ cordovaLocalNotification) { $ scope.lists = $ rootScope.lists;
$scope.testeNotificacao = function () {
$cordovaLocalNotification.schedule({
id: "1",
message: "Teste",
title: "Teste titulo"
}).then(function () {
console.log("Notificação teste");
});
}
})
But when I click the button it returns me the following error:
TypeError: Can not read property 'plugins' of undefined at Object.schedule (ng-cordova.js: 5042) at Scope $ scope.testeNotification (controller.js: 57) at fn (eval at compile (ionic.bundle.js: 27643), 4: 239) at ionic.bundle.js: 65429 at Scope $ eval (ionic.bundle.js: 30400) at Scope $ apply (ionic.bundle.js: 30500) at HTMLButtonElement. (ionic.bundle.js: 65428) at defaultHandlerWrapper (ionic.bundle.js: 16792) at HTMLButtonElement.eventHandler (ionic.bundle.js: 16780) at triggerMouseEvent (ionic.bundle.js: 2953)
I do not know how to use this plugin very well, so I wanted some help.
And when I installed the plugin as it was in the Cordova documentation: cordova plugin add link
He gave me the following warning:
Installing "cordova-plugin-local-notification" for android android-sdk version check failed ("C: \ apploja \ followork \ platforms \ android \ cordova \ android_sdk_version"), continuing anyways. Plugin does not support this project's cordova-android version. cordova-android: 5.1.1, failed version requirement: > = 6.0.0 Skipping 'cordova-plugin-local-notification' for android
Could someone please help me?
Att, Mauritius.