0

I created two applications and installed them on a device. Both apps have the same notification id. Whenever I send a push notification from my service, two notification show up.

I want to show only one notification (instead of displaying the same notification twice). Can I do it? If so then how can I do it?

ebarrenechea
  • 3,775
  • 1
  • 31
  • 37
Hoa.Tran
  • 935
  • 10
  • 26

1 Answers1

0

You can use a shared preferences between the two apps and write a value when some app show the notification. Then just before to show it you should check the shared preferences to know if the other application has shown the notification or not. Even you can add delay in one of the applications giving preference to the other one.

cdiazmo
  • 94
  • 1
  • 4
  • how I can use a shaf with two app? – Hoa.Tran Sep 09 '16 at 02:50
  • You can check it in [this answer](http://stackoverflow.com/questions/11025234/how-can-i-share-a-sharedpreferences-file-across-two-different-android-apps) a simple example To put values and get them check [this one](https://developer.android.com/training/basics/data-storage/shared-preferences.html) – cdiazmo Sep 10 '16 at 08:25