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 a window event will be emitted.

Listen for Events and show the content

To listen to NearIT events, add a listener:

nearit.addEventListener(function(event) {
  nearit.showContent(event);
})
nearit.addEventListener(event => {
  nearit.showContent(event);
});

This setup will automatically show the content (if any). If you want to handle the content manually, head to this section.

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");
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");
nearit.showCouponList('An optional title');

This is the result:

couponlist

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