سؤال

I am developing an Android app that allows sports team coaches to update the attendance for events like training/matches. A feature I would like to add would be to display a notification on the device to remind them that they need to update the attendance for the event when it has started.

I have been reading online a bit and it seems that push is the preferred method for data that is changing. But because i know the start times of the events, would it be better to create a background service using something like the following?

https://stackoverflow.com/a/9933130/2039505

I basically want the user to receive a vibrate notification which when they click on it, it will open the events attendance screen. Hopefully someone will have some insight into which option is best!

هل كانت مفيدة؟

المحلول

Since all you need is a notification on a timer, the AlarmManager would be the best way to go.

If you used Push Notifications(GCM), that would require server side code and a method to store the device id to send the notification to.

Overkill if you ask me.

Here are links to the official documentation and example code:

Official documentation

Vogella's example on services

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top