Push Notifications

Integrate your app with Gameball push notifications and interactive in-app messaging.

Gameball uses Firebase to deliver maximum experience in your app. This includes push notifications, interactive in-app messaging.

Configure Gameball With Your Firebase

Before you start, you must configure your Firebase on your Gameball account. Follow the steps in Configure your Firebase account on Gameball for mobile push notifications article from our Help Center related to push notifications.

Handling Push Notifications Integration

For notifications handling, add this code to the onNotification function in your app:

onNotification: (notification) => {
// you need to check the platform because firebase send the notification based on the platform

if (Platform.OS === 'android') { // Android
          if(notification.isGB){
                  // send notification direct to InAppNotification as described below
          }
        }
        else { // IOS
          if (notification.data.isGB) {
                  // send notification.data to InAppNotification as described below
          }
        }
}

Import InAppNotification

import {InAppNotification} from 'react-native-gameball';

InAppNotification takes the following properties:

You can use it in different two ways: one is by adding it directly underneath the main app like shown.

<Provider>
    <AppNavigator>
    <InAppNotification 
      notification={this.props.notification}
    />
</Provider>

Another approach is to have a separate component which handles the InAppNotification component and pass to it the data directly.

SeparateComponent.tsx
render(){
    return(
    <InAppNotification
        readnotification={this.props.notification}
    />
   )
}

After that, add it underneath your main app component as follows.

<Provider>
        <AppNavigator />
        <SeparateComponent/>
</Provider>

Your users can now receive push notifications from Gameball.

Last updated