Inherits from NSObject
Declared in LUAPNDeviceRequestFactory.h
LUAPNDeviceRequestFactory.m

Overview

LUAPNDeviceRequestFactory is used to build requests for APN (Apple Push Notification) device tokens. If the app is going to handle push notifications, the device token must be registered with LevelUp, and unregistered if necessary.

When an iOS app registers for push notifications, application:didRegisterForRemoteNotificationsWithDeviceToken: will be called on the application delegate. This device token needs to be registered with the LevelUp servers so that push notification can be delivered after an order is made.

Best Practices

As described by Apple the process for registering for remote notifications is to first call registerForRemoteNotificationTypes:. Then the app delegate will receive application:didRegisterForRemoteNotificationsWithDeviceToken:. The device token will be passed to this method. Apple recommends that an application should register every time it launches.

Any time a device token is registered, it should be sent to LevelUp via the SDK.

Class Methods

requestToRegisterAPNDeviceWithToken:sandbox:

Builds a request to register an APN device with LevelUp.

+ (LUAPIRequest *)requestToRegisterAPNDeviceWithToken:(NSData *)deviceToken sandbox:(BOOL)sandbox

Parameters

deviceToken

An APN device token to register.

sandbox

Specifies whether notifications should be sent to this device in sandbox mode (which uses Apple’s sandbox notification server) or production (which uses Apple’s production notification server). Typically this would match LUAPIClient’s development mode.

Discussion

Builds a request to register an APN device with LevelUp.

This method will also securely store the device token, so that it can be unregistered later.

Warning: This request requires an access token with either the LUPermissionCreateOrders or LUPermissionReadQRCode permission.

Declared In

LUAPNDeviceRequestFactory.h

requestToUnregisterCurrentAPNDevice

Builds a request to unregister the current device token.

+ (LUAPIRequest *)requestToUnregisterCurrentAPNDevice

Discussion

Builds a request to unregister the current device token.

This token will have been set by a previous call to requestToRegisterAPNDeviceWithToken:sandbox:.

Declared In

LUAPNDeviceRequestFactory.h