Base type for creating a notification bar to show incoming FelgoMultiplayer push notifications in-game. More...

Import Statement: import Felgo 3.0


Detailed Description

NotificationBar is the base type for creating a notification bar to show FelgoMultiplayer push notifications.

When a push notification arrives, the FelgoMultiplayer item automatically displays a default notification bar to show the message if the chat view is not opened. After a few seconds, the notification will disappear automatically. Clicking the notification opens the chat view.

Alternatively, you may specify a custom NotificationBar item to replace the default navigation bar and handle notifications on your own.

Note: The notification bar is only displayed if FelgoMultiplayer::handleNotificationInternal is activated, which is the default setting. The FelgoMultiplayer::notificationReceived signal is emitted in every case, so it is possible to still react to notifications on your own.

Set your own NotificationBar implementation for FelgoMultiplayer::notificationBar to replace the default notification bar. Whenever FelgoMultiplayer forwards an incoming notification to be displayed by the NotificationBar, the NotificationBar::display signal is emitted.

Signal Documentation

display(string = message, var = additionalData, bool = isActive)

Whenever FelgoMultiplayer forwards an incoming notification to be displayed by the NotificationBar, this signal is emitted.

The following example uses the signal to disable the default notification bar for chat messages and opens the chat view instead. For friend requests and game invites the notification bar will still be shown.

 FelgoMultiplayer {
   id: multiplayer

   // ...

   // use signal handler to hide notification bar for text messages and jump to chat instead
   Connections {
     target: multiplayer.notificationBar || null
     onDisplay: {
       if(additionalData.type === "text") {
         multiplayer.notificationBar.visible = false
         multiplayer.showChat(additionalData.sender, additionalData.sender_name)

To set a completely custom notification bar instead of the default one, specify your own implementation as the FelgoMultiplayer::notificationBar. Then implement the signal in your custom notification bar to show incoming notifications in the way you want.

The following example shows notifications in a native alert dialog instead of a notification bar (the actual NotificationBar item is never visible in this case):

 GameWindow {
   // ...

   FelgoMultiplayer {
     // ...
     notificationBar: myNotificationBar

   NotificationBar {
     id: myNotificationBar
     onDisplay: {
       nativeUtils.displayMessageBox(additionalData.title, message, 1)

Note: If the multiplayer chat view is opened and can display a notification directly, this signal is not fired. The notification can be consumed and visualized directly in that case. To react on all notifications regardless of the opened view or other FelgoMultiplayer settings, use the FelgoMultiplayer::notificationReceived signal instead.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
create apps
create games
cross platform
native performance
3rd party services
game network
level editor
easiest to learn
biggest time saving
best support