pb4now pb4now - 23 days ago 7
Android Question

Checking for changes in Firebase database while application is closed

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?

Answer

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.