Hide local notification


#1

I am scheduling local notifications on user’s behalf and performing an action like sending sms when the notification triggers…
Now I want to prevent the notification from appearing in the notification bar i.e. I want to send sms at the scheduled time without notifying the user… How can I do that ?? Any help would be appreciated


#2

#How to tutorial

I wrote a tutorial for you; it talks about the local notifications, in general, but you’ll also find a function to cancel a local notification. It doesn’t matter if it’s a one-time notification, scheduled notification or any other notification.

##Read it here.


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?

#3

Thanks a lot Gajotres but dear my actual desire is to hide the notification from appearing at front end i.e. in the device notification bar… I am already scheduling notifications and sending sms like this

$rootScope.$on(’$cordovaLocalNotification:trigger’,
function (event, notification, state) {
$scope.SendSMS();
});

but I don’t want to bother the user every time sms is sent … My notification tiggers every hour, so what I really want is to send sms on every hour but I don’t want the notification to bother device user on every hour , it would definitely be frustating otherwise.
Is it possible ??


#4

May I ask, why are you then using notifications if you don’t want to display them?

Why don’t you simply using setinterval function. It can trigger every one hour and you don’t need to bother with notification.


#5

I am making a scheduling app , so the requirement could be sending a single sms every month for one contact or something like sending sms every hour for another contact… will setinterval work fine with this scenario like user set date and time to send sms and sms will be sent from background on that date time ??

I am just a beginner in this area and you can guide me with a better approach


#6

I guess set interval won’t work if the application is closed … it won’t schedule sms at some date time


#7

Dear Gajotres i am facing exactly the same problem, would you like to please guide me how can i hide notification for appearing in notification bar?
Is there any way to perform background task or service as an alternative.Waiting for your response.Thanks


#8

Any solution to scheduler background tasks?

I thought in the same workaround to do this: schedule a local notification (that runs perfectly in background, including when app is closed), but not shows notification exactly. But I guess that exists better solution.


#9

@MudassirAli I am facing issue now. Did you get any solution to prevent the notification from appearing in the notification bar?