How to repeat local notifications every day at different times

前端 未结 4 573
名媛妹妹
名媛妹妹 2020-12-28 09:45

I\'m working on a prayers application that enables users to set an alarm(local notification) for prayer times, i.e. the user sets the application to notify him for Fajr pray

4条回答
  •  梦谈多话
    2020-12-28 10:44

    There are three ways to do this:

    1. Use push notifications instead of local notifications and move the logic to the server. Problem - user won't get notifications when offline.

    2. Keep using local notifications. You will have to plan a new notification for every prayer time. Of course, the number of local notifications is limited (max 64 scheduled notifications) but it should be enough for a week of notifications. A notification is not an alarm, the user is supposed to open the application in response to receiving a notification. That way, you can always reschedule all notifications when the app is reopened. Also, the last notification can be something similar to "you have not opened the app in a while, you won't be receiving more notifications".

    3. Instead of creating local notifications, create alarms/reminders in your device calendar (Event Kit)

提交回复
热议问题