0

I am working on multiple apps having Firebase notification library. I will be using third party portal to send notification. Suppose I want to send one promotional notification to all my apps and one device is having my 3 apps install. Now all 3 apps will show the same notification. How can I avoid this scenario.

Also, I have created one library to generate notification according to json received. When I get notification, I am sending data to this library. This library is added in all my apps.

Can any of following help

1: Handling from backend- Creating one firebase project and adding multiple apps.

2: Reading notification id in library which will generate notification and checking if any notification is already generated for the id.

As there is no way of finding out if one or multiple apps are install on one device, I have to send notifications to all apps.

Akshay Pure
  • 73
  • 1
  • 1
  • 8

1 Answers1

2

With simple notifications, you can't: they are generated automatically by the system. You'll have to send data messages and implement a logic to check whether any other of the 3 apps is installed and generate the notification only from 1 app (prioritize)

Nick
  • 585
  • 4
  • 11
  • Where should I implement that logic? Say, I am getting unique id with notification and I have implemented logic using this id. Where can I store this id. I need to keep track this if even if user uninstalls one of the app – Akshay Pure Aug 07 '17 at 12:01
  • 1
    you don't have to stick to any ID, just define a Priority. App1 = 1 App2 = 2 App3 = 3. If App1 receives a data message, it generates a notification without checking. If App2 receives a data message, generates notification only if App1 not installed. App3 only generates a notification if App1 and App2 are not installed https://stackoverflow.com/questions/18752202/check-if-application-is-installed-android - check if package installed https://firebase.google.com/docs/cloud-messaging/concept-options - to understand the two different types of notifications – Nick Aug 07 '17 at 12:07
  • Awesome...thanks a lot. I can send priority in notification json data and have logic in my library to handle this. – Akshay Pure Aug 08 '17 at 07:01