Herve B
Herve B

Reputation: 195

Android and specific notifications

I want my app to notify users of specific events that can occur at a certain time.

I know how to send a notification knowing the exact time of it, but things get a little complicated for me when I want to trigger notifications at times that are unknown at app install (notifications whose time can change or which depend on a specific event).

Here are two cases in which I don't know how to trigger a notification :

How can I achieve this ?

Thanks !

Upvotes: 2

Views: 105

Answers (1)

Chris
Chris

Reputation: 3338

For your first option i would use a AlarmManager. It will execute a function on a specific time, that can be set on app startup. Everytime the AlarmManager executes and sends a notification to the user, it should re-calculate the next message time and reset the AlarmManager. ( see how to reset here )

For your second scenario you could use a library like OneSignal. It's a verry usefull library for registering users for pushnotifications and sending messages from a website to your users. You can choose groups of users or specific users for sending messages and you can customize the look of your pushmessages ( add buttons, images, .. etc).

Upvotes: 3

Related Questions