When I send multiple push notifications, I need them to be all shown in the notification bar ordered by the time sent desc. I know I should use unique notification - I tried
private static final String PREFERENCE_LAST_NOTIF_ID = "PREFERENCE_LAST_NOTIF_ID";
private static int getNextNotifId(Context context) {
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
int id = sharedPreferences.getInt(PREFERENCE_LAST_NOTIF_ID, 0) + 1;
if (id == Integer.MAX_VALUE) { id = 0; } // isn't this over kill ??? hahaha!! ^_^
sharedPreferences.edit().putInt(PREFERENCE_LAST_NOTIF_ID, id).apply();
return id;
}