Mark Kazakov
Mark Kazakov

Reputation: 1116

Silent notifications on Android

Hello fellow programmers. I have a problem and would appreciate any insights. An app that I'm developing should receive notifications - silent and regular. When the app is open or in background everything is good, I receive every notification in a "silent" way and if logic requires it I pop a local notification. The problem is when app is closed (cleared from background), I need to get a silent notification but every notification is handled by the operating system and pops it for the user to see. What should I do to handle the app closed case? Thanks.

Upvotes: 0

Views: 742

Answers (1)

Attiq ur Rehman
Attiq ur Rehman

Reputation: 475

It's not default behavior but you could achieve this by using a dirty logic. In your receiver/service class [who generates notification], just check any activity of your required application is active or not. If your application is not in active state than don't generate the notification.

Upvotes: 1

Related Questions