Daily notifications

I need a bit of guidance, so for my application, I'm looking for local notifications to send a notification every morning at 7 o'clock.

The problem I am running into is how can I make the content for the local notification dynamic, mainly the body and the attached image? As it will change for the user on a daily basis.

What would be the best way to do this since you cannot edit future notifications.

-1


source to share


1 answer


Here's a quick tutorial on notifications. First, what is a notification? This is basically a warning presented by the system on your behalf. Secondly, there are two types of notification: local and remote.

Imagine, then, an application that aims to present the user with a notification every morning at 7 a.m. saying that the current temperature is outside. (For example, suppose we have a way to study this information.)

An instant thought will show that this cannot be done with local notifications. We cannot know the current temperature at 7 a.m. until 7 a.m. (or close to it), and we cannot schedule a notification if the app is down. So we'll need a lot of luck for the app to run at 6:59 am for this app to work. But the app only works when the user invokes it, so this is highly unlikely.



Therefore, this kind of task is only possible with remote notifications. The remote server is always running; therefore, it can receive the temperature and "ping" of the user's device at 7 am and the system will present a notification on your behalf. Therefore, you need to have such a server in order to write an imaginary application.

(An alternative to using local notifications would be that you schedule, say, a weekly local notification in advance. Then if you have a lot of luck to find an app running before the notification is presented, you will rip off all scheduled notifications and do so. again with a more up-to-date projection. But of course, this may not work as well as using remote notifications, and it will stop working completely after a week unless the user launches the application. That sounds pretty weak, to put it bluntly.)

+5


source







All Articles