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 Welcome Notification 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.
Prerequisites - What you need to get started
- Your SDK credentials, including an SDK Login (identifier on Herow) and Password (SDK Key on Herow) to initialize the SDK.
- A zone, which has been configured on your herow account.
- An Android Device, with Bluetooth 4.0 and Android 4.0 and above, to be able to interact with BLE beacons.
- The Android Studio application, which you can download from the Android Developers website.
- You must have completed the zone 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
- Open the android>zone>2-Notification>Starter project with Android Studio
Step 2: Configure the SDK
- Open the ApplicationNotification class
- Configure the SDK with:
- the appropriate Herow Environment ( PREPROD / PROD )
- your SDK credentials (your login and password details from Connecthings)
HerowInitializer.getInstance() .initInstance(this) .initUrlType(UrlType.PRE_PROD / UrlType.PROD) .initApp("YOUR_IDENTIFIER", "YOUR_SDK_KEY") .synchronize();
If you need more informations, have a look to the 5 minutes quickstart tutorial
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. The only element that needs to be configured at SDK level is the icon associated with the notification (optional).
You can customize this icon, by adding the following to your drawable resources folder:
- icon_welcome_notification_android_4 for Android 4 or below.
- icon_welcome_notification for Android 5 and above.
Starting from Android O, the welcome notifications and the zone notifications are published in a dedicated notification channel.
You can learn more reading the notification tutorial
Configure a custom-built Welcome Notification
The Welcome Notification process is similar to the zone notification process, and so to generate a custom-built Welcome Notification, you can use:
- a NotificationTask, 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 NotificationTask or NotificationBuilder, use the dedicated welcome notification method to register it to the HerowDetectionManager:
HerowDetectionManager.getInstance().registerEnterWelcomeNotificationBuilder(new CustomNotificationBuilder()) HerowDetectionManager.getInstance().registerEnterWelcomeNotificationTask(new CustomNotificationTask());
Refer to our quick start tutorial to test the project
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.
Some Android 6 and later smartphone models now need location to be activated in order to enable background zone detection.
On Android, the image associated with a notification can only be displayed if the notification is the first in the smartphone’s list. Some OS versions & smartphone brands offer their users the ability to extend the notification to view the image, when it is not the first in the list.
If you want to perform several tests in a row, 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).