0

I've a (rich) Notification in my Android App which is currently using the BigPictureStyle

The Bitmap which is shown changes from time to time, therefore I need to update the notification, which is not a big deal BUT I don't know when my Notification is shown and therefore do not know when to update the Notfication.

Creating the bitmap is quite performance intensive, therefore I do not want to do it more than necessary. Do you have any idea, how I can update my Notification as less as possible but as much as needed?

fish
  • 828
  • 1
  • 6
  • 14
  • Please check this ans: http://stackoverflow.com/a/9489220/1168654 and it sure help you : http://developer.android.com/guide/topics/ui/notifiers/notifications.html#Updating – Dhaval Parmar Apr 03 '13 at 12:26
  • The problem in my case is not the update process itself, the problem is, that my Bitmap "always" changes but there is no need to create a Bitmap and update the notification if the notification is not visible. I want to avoid updating the notification, let's say every minute which would be useless in probably 99% of the cases. – fish Apr 03 '13 at 12:46
  • Yeah, there's essentially no way to do what you want (and even if there were, since computing the bitmap is apparently quite complex, the user's device would slow down every time she opened the notification panel—not cool). – dsandler Apr 04 '13 at 14:25

1 Answers1

0

Android does not allow to check whether the notification is shown or not. I too had the same problem.

What you can do is store the Date (in shared preferences) when its shown last time just before showing notification. Then check this date and find whether you need to show again or not.

Vivek Khandelwal
  • 7,829
  • 3
  • 25
  • 40