Android Notifications Overlap Each Other
I have two services who both create notifications independently from each other. But when I start them both, They are like 'fighting'(go up and down) for the position. I hope anyon
Solution 1:
I had a similar problem and I tried all sorts of methods. I was eventually able to solve it using sharedpreferences. Although this isn't a relatively popular way of doing this, it helps because you can keep track of every notification sent. Here's a code snippet:
SharedPreferencesprefs= getSharedPreferences(Activity.class.getSimpleName(), Context.MODE_PRIVATE);
intnotificationNumber= prefs.getInt("notificationNumber", 0);
notificationManager.notify(notificationNumber, notification);
SharedPreferences.Editoreditor= prefs.edit();
notificationNumber++;
editor.putInt("notificationNumber", notificationNumber);
editor.commit();
I hope this helps.. Merry coding!!!
Post a Comment for "Android Notifications Overlap Each Other"