How to use apollo subscription in a foreground service in android?

I want to use apollo subscription even when app is closed and screen is off. Is it possible? If not - what would you recommend to use instead?

Example:
I must vibrate phone when there are specific data is changed in the database.
I must make some network requests when specific data changed in the databse
And so on…

Should I use apollo subscription for these goals? Or should I use push-notifications for that? But the documentation says that I need high-priority notifications, and they are must be user visible content. I am not going to crate Vibrating notifications when the phone is vibrating :grin:

Hi :wave:!

I want to use apollo subscription even when app is closed and screen is off. Is it possible? If not - what would you recommend to use instead?
Should I use apollo subscription for these goals? Or should I use push-notifications for that?

It all depends your use case. If you need very precise control over the notification or do not want to go through Android notifications, I guess you can use a foreground + a WakeLock. In general though, I would recommend using the Android push notification as it’s a much more power efficient way to wake up your app when needed.

1 Like

Thank you :slight_smile:

About “It all depends your use case.” - our applications will have multiple features which are going to be work when the applications is closed and screen is off so the variant with foreground service and wake lock is fine