What you will learn

In our Welcome Notifications document, you learned that you could display an additional notification on your users’ smartphones, the first time they interact with a zone after a given period of time.

Just like it contains an Auto Notification, our SDK features a built-in, default Auto WelcomeNotification that allows you to automatically generate a Welcome Notification once the SDK is synchronized with Herow.

You can choose either to keep this default notification, or replace it with your own custom-built Welcome notification.

This tutorial teaches you how to configure both types of Welcome Notifications.

Pre-requisites - What you need to get started

  • Your SDK credentials, including an SDK Login, Password, and Company Key to initialize the SDK.
  • A zone, which has been configured on your herow account.
  • An iOS Device, with Bluetooth 4.0 and iOs 9 and above.
  • The Xcode application, which you can download from the App store.
  • You must have completed the Notification Tutorial.

Initialize the SDK

Step 1: Clone the sdk-tutorial repository

  • Clone the sdk-tutorial repository
git clone https://github.com/opsct/sdk-tutorial.git

ObjectiveC:

  • Open the sdk-tutorial>ios>ObjectiveC>Zone>2-Notification folder

SWIFT:

  • Open the sdk-tutorial>ios>SWIFT>Zone>2-Notification folder

Step 2: Configure the SDK

  • Configure your CocoaPod files and .plist
  • Configure your SDK with:
    • the appropriate Herow Environment ( PREPROD / PROD )
    • your SDK credentials

Switch to Swift

[[[[HerowInitializer sharedInstance] configPlatform: HerowPlatform.prod]
									 configUserWithLogin:@"your username"
									 password:@"your password"
									 company:@"your company"]
									 synchronize];

herowInitializer = HerowInitializer.shared
herowInitializer?.configPlatform(Platform.prod)
				 .configUser(login: "your username", password: "your password", company: "your company")
				 .synchronize()

If you need more informations, have a look to the 5 minutes quickstart tutorial

Enable your app to receive local Welcome Notifications

We invite you to read the 5 minutes QuickStart Tutorial to check the steps to receive the local Notifications.

Activate & configure your Welcome Notifications in Herow

Welcome Notifications can be activated and configured directly on our Herow platform, in the Welcome Notification section.

For additional information on Welcome Notification settings, refer to our Introduction to Welcome Notifications.

Choose your Welcome Notification configuration

Work with Auto Welcome Notifications

Once the Welcome Notification feature is enabled on Herow, and a content is defined, our SDK automatically starts generating Auto Welcome Notifications.

Configure a custom-built Welcome Notification

The Welcome Notification process is similar to the notification process, and so to generate a custom-built Welcome Notification, you can use:

  • a HerowNotificationTask, interface to realize an async task to associate additional content to the WelcomeNotification before generating the notification.
  • a NotificationBuilder, interface to personalize the content of the notification.

To learn more about implementing your own NotificationBuilder, you can read the dedicated tutorial

Once, you have implemented your own HerowNotificationTask or NotificationBuilder, use the dedicated welcome notification method to register it to the HerowDetectionManager:

Switch to Swift

[[HerowDetectionManager shared] registerEnterWelcomeNotificationBuilder:[MyCustomNotificationBuilder alloc]];
[[HerowDetectionManager shared] registerEnterWelcomeNotificationTask:[MyCustomNotificationTask alloc]];
HerowDetectionManager.shared.registerEnterWelcomeNotificationBuilder(MyCustomNotificationBuilder())
HerowDetectionManager.shared.registerEnterWelcomeNotificationTask(MyCustomNotificationTask())

Start testing

If your beacon is already emitting, you must stop/restart the emission process in order to simulate a new region entry for the smartphone, and generate a notification.

There are 2 solutions to stop/restart the emission process:

  • You can put the beacon inside a microwave (but don't start it!)
  • You can remove the battery from the beacon (in that case, depending on the model, it can take up to 30 seconds for the beacon to start emitting again when you put the battery back)
  1. From Xcode, launch the installation of the application you have just built on your mobile phone.

    • If you want to perform several tests in a row, for instance to check both your “Offline” and “Online” Welcome notifications, make sure that you completely uninstall and reinstall the application each time. Otherwise, you will not be able to see any new Welcome Notifications for the next 12 hours (default setting).
  2. When the application starts, popups ask for permission to access your phone location & notifications: grant them!

  3. Close your application or leave it running in the background

  4. Remove the beacon from the microwave or put the battery back.

  5. Wait for a few seconds (maximum 1 minute)

  6. Click on the notification that has appeared on your screen just for fun.

Reminder:

Welcome Notifications are configured for the whole app, and not at the zone level.

This means that the content of the notification is not associated with the specific zone that the user is interacting with.