Checking for changes in Firebase database while ap

2019-07-30 09:41发布

问题:

What is the 'right' way to set up checking for changes of a value in Firebase DB, while application is closed, and then push notifications to a user?

Should I use Service, Alarm and pendingService classes to get that done?

回答1:

You should use android Service to run your tasks on background even after your app has closed.

Check this link on how to use the android services to run background tasks.

Also Alarm and pending services work best if your background task gets triggered upon change in other system parameters such as connectivity or any specific time interval or time.