I create a project with ionic , in this project I read a list of data from an external json file ($http) and I want to create a local notification when there are a new item in this list by using ng-cordova-localNotification. How can I do that ??

Go to ng-cordova.com or to the plug-in github page, they explain how you can manage that. Otherwise, contact me privately so i can provide you some code.

1 Like

#How to tutorial

I wrote a brand new tutorial for you.

###Read it here.

Everything you require can be found there, including a working example you can reuse in your application. Every step is described in great details so make sure you read everything.

When you finish please tell me these things:

  1. Have you understood everything
  2. Is it missing something
  3. Would you like to see something more? Maybe a downloadable GitHub repository example?

###And remember, we’re always here to help you. Now have a nice day :smile:


I forgot one thing. My tutorial won’t be enough for you. You will need to trigger notifications when received JSON changes content. You can use a simple AngularJS directive to check if JSON string has changed in any way, find it here:

1 Like

Thanks @josnyS , @Gajotres for your help,
I tested the ng-cordova local notifications plugin and it works perfectly in my app .
the big problem for me now is to trigger notification when received JSON changes content for each new item in the json file.
I’m beginner with angularJs .

Look at a P.S. section I wrote you in my previous answer.

Could you give me an example of using this AngularJs directive with local notifications in ionic ??

Sorry, I don’t have time for that … you’re a developer so find time and learn about it … I gave you everything you need to know.

Hi wadouda, did you manage to do something about your problem? If you did, could you please post your code here or just point people to solution. It would be useful for everybody. Thank you!

Hi , I am creating an app with daily local notifications, I would like the user to provide the time, so i used ionic time picker plugin and saved the epoch to the sqlite database, then i get the epoch and used the date function and used getMinutes and getHours and then setHours and setMinutes to the local time, and I also used every value as “day” , What am i dont wrong ? When i set the value of the at to + 5 seconds after current time like in the example everything works fine. Here is my Code snippet from app.js

$scope.timings = '';
 var notification_query = "SELECT time FROM Notification WHERE id = 1";

$cordovaSQLite.execute(db, timeset_query).then(function(res) {
  if(res.rows.length > 0) {
 $scope.alarmSetTime = $scope.timings;
       } else {
        console.log("No results found");
var alarmTime = new Date($scope.alarmSetTime*1000);
 var hours= alarmTime.getHours();
 var Mins = alarmTime.getMinutes();

var sec = alarmTime.getSeconds();

var now = new Date().getTime(),
nowtime = new Date(now +5*1000);

    id: "1234",
    at: nowtime,
    message: "This is a message",
    title: "This is a title",
    autoCancel: true,
    sound: "file://lib/notify.mp3"
}).then(function () {
    console.log("The notification has been set");

Log says: The notification has been set. But I dont get any any notifications.