Local notification Ionic v1

Asked

Viewed 137 times

0

Good night.

Can someone give me a help on how to use cordovaLocalNotification?

I created a test button in the view with the ng-click="test function()"

And on my controller it’s like this:

.controller('Listingcontroller', 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: Cannot read Property 'plugins' of Undefined At Object.Schedule (ng-Cordova.js:5042) At Scope.$Scope.testNotification (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) triggerat MouseEvent (Ionic.bundle.js:2953)

I do not know how to use this plugin very well, so wanted a help.

And when I went to install the plugin as it was in the Cordova documentation: Cordova plugin add https://github.com/katzer/cordova-plugin-local-notifications.git

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 doesn’t 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

Would someone please give me a hand?

Att, Mauritius.

1 answer

0


The first error refers to the plugin not being installed. The second error, the installation (ie it is the first error) is referring to the plugin local-Notifications not working on Cordova-android 5.1.1 you need to update your Cordova first before installing the plugin. This can be done using Cordova-cli on the command line:

cordova platform update android

Browser other questions tagged

You are not signed in. Login or sign up in order to post.