Send cordova local notification on particular condition without using `every`

I am working on Ionic iOS app i need to implement local notification every time when my order is success or change in order status. For this i have install cordova local notification.

What i need is to check every minute whether logged in user status changed or not if status change then send notification to user .

I am unable to implement this i have tried a lot but no luck please help me

Are you sure you want to build this using local notifications and a polling mechanism? This sounds like a perfect match for a notification sent by the system that already knows about the status change (or a middleware built onto that system).

Yes @Sujan12 , i want to build this using local notifications.

Haha, this was meant more as a rethoric question instead of writing “You probably shouldn’t do that…” but of course you can do it whatever way you want :wink:

What exactly did you try? For me it sounds like you have to start the polling at some event (order created?) and keep polling for this change. If it happens, trigger local notification. (As the app won’t be open or in the foreground at all times, you probably have to look into background processes, too)

(And then you have to figure out a way to not drain the battery with all the polling going on)

(And then figure out what to do if your background process is killed by the OS anyway)

@Sujan12 I have made condition for checking logged in user order status but i need to check every 1 minute or or every time order status of logged in user, whether app is in background state or foreground than send notification immediately. but i am unable to check status every time and send notification.

If i schedule notification every minute than it will send same notification every minute. i don’t understand what to do or m i at right track?


You can keep a list of notifications sent (that basically only includes the order_id or something) and then NOT send the notification if the order that now wouldget a notification already got one before.

@Sujan12 , I am using setinterval for repeatation and checking condition but single notification not working. If i add every its working but not changing every time.

Define please. This isn’t enough to help.

@Sujan12 when i use single local notification means without using ‘every’ in local notification options array, notification not appear in my iphone if i add every its working but i need a single notification in setinterval where i am checking logged in user order status.