Real-time support

To optimize battery consumption, the SDK uses a push mechanism to enable real-time support when the SDK user is being tracked by someone. The iOS SDK uses APNs remote (silent) notifications as one of the push mechanisms. This guide will take you through the APNs setup for the SDK.

[info] Prerequisites

This guide assumes you have configured APNs in your application. If you haven't, read the iOS documentation on APNs.

Configure APNs on the dashboard

APNs certs Log into the HyperTrack dashboard, and open your account settings. Upload your APNs development and distribution certificates (.pem files).

These certificates will only be used to send remote push notifications to your apps.

Enable remote notifications in the app

Background modes In the app capabilities, ensure that remote notifications inside background modes is enabled.

Registering and receiving notifications

The following changes inside AppDelegate will register the SDK for push notifications and route HyperTrack notifications to the SDK.

Register for notifications

Inside didFinishLaunchingWithOptions, use the SDK method to register for notifications.

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {

Register device token

Inside and didRegisterForRemoteNotificationsWithDeviceToken and didFailToRegisterForRemoteNotificationsWithError methods, add the relevant lines so that HyperTrack can register the device token.

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
    HyperTrack.didRegisterForRemoteNotificationsWithDeviceToken(deviceToken: deviceToken)

func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
    HyperTrack.didFailToRegisterForRemoteNotificationsWithError(error: error)

Receive notifications

Inside the didReceiveRemoteNotification method, add the HyperTrack receiver. This method parses only the notifications that sent from HyperTrack.

func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) {
    if (HyperTrack.isHyperTrackNotification(userInfo: userInfo)){
        HyperTrack.didReceiveRemoteNotification(userInfo: userInfo)

    // Do any additional handling for your app's notifications.
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo{
    if ([HyperTrack isHyperTrackNotificationWithUserInfo:userInfo]){
        [HyperTrack didReceiveRemoteNotificationWithUserInfo:userInfo];

    // Do any additional handling for your application's notifications.

results matching ""

    No results matching ""