# New message notification in foreground

**URL:** <https://community.sendbird.com/t/new-message-notification-in-foreground/3813>\
**Category:** Android\
**Created:** [January 19, 2022, 7:56am UTC](https://community.sendbird.com/t/new-message-notification-in-foreground/3813 "2022-01-19T07:56:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![swordi](https://avatars.discourse-cdn.com/v4/letter/s/278dde/32.png) [@swordi](https://community.sendbird.com/u/swordi)\
**Post date:** [January 19, 2022, 7:56am UTC](https://community.sendbird.com/t/new-message-notification-in-foreground/3813/1 "2022-01-19T07:56:07Z")

</div>

So when sendbird is not sending push notifications when an app is online (in foreground) what is the best way to inform the user, that there are new messages?

the main use case for my app is to browse marketplace items, the chat is only a small part of it. So the user browsers a long time and will not receive any notifications, that there are new chat messages.

Thanks a lot for your help

---

<div class="post-metadata">

**Author:** ![Woo](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/woo/32/125_2.png) [@Woo](https://community.sendbird.com/u/Woo)\
**Post date:** [January 19, 2022, 8:20am UTC](https://community.sendbird.com/t/new-message-notification-in-foreground/3813/2 "2022-01-19T08:20:39Z")

</div>

if user is online (or foreground), you can utilize event handlers [Event handler | Chat Android SDK | Sendbird Docs](https://sendbird.com/docs/chat/v3/android/guides/event-handler)

---

<div class="post-metadata">

**Author:** ![swordi](https://avatars.discourse-cdn.com/v4/letter/s/278dde/32.png) [@swordi](https://community.sendbird.com/u/swordi)\
**Post date:** [January 19, 2022, 8:24am UTC](https://community.sendbird.com/t/new-message-notification-in-foreground/3813/3 "2022-01-19T08:24:30Z")

</div>

So i need to register an event handler for each channel of the user to possible get updates of messages?

Should I do that in Application::onCreate or where is the best place for that?

---

<div class="post-metadata">

**Author:** ![Woo](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/woo/32/125_2.png) [@Woo](https://community.sendbird.com/u/Woo)\
**Post date:** [January 19, 2022, 8:29am UTC](https://community.sendbird.com/t/new-message-notification-in-foreground/3813/4 "2022-01-19T08:29:03Z")

</div>

No you don’t have to register an event handler for each channel. Theres an example on docs.  
For second question, it depends but encourage to register before you call `connect` method.
