Skip to content

Handle In-app content

This setup allows NearIT to deliver and show notifications and content.

Request notification permission

Please remember to request notification permission: on iOS no content will be delivered if user did not grant it.

When a NearIT notification is tapped an event will be emitted.

Listen for Events and show the content

To listen to NearIT events, add a listener:

this.eventsSubscription = NearIT.addContentsListener(event => {
  NearIT.showContent(event);
});

N.B: Remember to unsubscribe from events (you'd want to do this when the component is unmounted)

NearIT.removeContentsListener(this.eventsSubscription)

Notification History

If you want to show the user notification history, you can do it by calling the following method:

NearIT.showNotificationHistory("An optional title");

This is the result:

notificationhistory

If you wish to handle yourself the notification history, head to this section.

Coupon History

NearIT.showCouponList("An optional title");

This is the result:

couponlist

If you wish to handle yourself the coupon list, head to this section.