ApplicationDelegateHandlers
public class ApplicationDelegateHandlers
Handles methods for application lifecycle events, local and remote notifications.
If PredixMobilityConfiguration.automaticallyListenForApplicationStateEvents is true, the SDK will automatically handle application lifecycle events, however local and remote notification event method calls will need to be passed to the SDK from the container app.
-
When PredixMobilityConfiguration.automaticallyListenForApplicationStateEvents is false, this method can be used to inform the SDK of the applicationWillResignActive event from a consuming application.
Would be called by the container’s AppDelegate, example:
func applicationWillResignActive(_ application: UIApplication) { PredixMobilityManager.sharedInstance.applicationDelegates.applicationWillResignActive(application) }
Declaration
Swift
public func applicationWillResignActive(_ application: UIApplication)
Parameters
application
the UIApplication object
-
When PredixMobilityConfiguration.automaticallyListenForApplicationStateEvents is false, this method can be used to inform the SDK of the applicationDidBecomeActive event from a consuming application.
Would be called by the container’s AppDelegate, example:
func applicationDidBecomeActive(_ application: UIApplication) { PredixMobilityManager.sharedInstance.applicationDelegates.applicationDidBecomeActive(application) }
Declaration
Swift
public func applicationDidBecomeActive(_ application: UIApplication)
Parameters
application
the UIApplication object
-
When PredixMobilityConfiguration.automaticallyListenForApplicationStateEvents is false, this method can be used to inform the SDK of the applicationWillTerminate event from a consuming application.
Would be called by the container’s AppDelegate, example:
func applicationWillTerminate(_ application: UIApplication) { PredixMobilityManager.sharedInstance.applicationDelegates.applicationWillTerminate(application) }
Declaration
Swift
public func applicationWillTerminate(_ application: UIApplication)
Parameters
application
the UIApplication object
-
When PredixMobilityConfiguration.automaticallyListenForApplicationStateEvents is false, this method can be used to inform the SDK of the applicationDidEnterBackground event from a consuming application.
Would be called by the container’s AppDelegate, example:
func applicationDidEnterBackground(_ application: UIApplication) { PredixMobilityManager.sharedInstance.applicationDelegates.applicationDidEnterBackground(application) }
Declaration
Swift
public func applicationDidEnterBackground(_ application: UIApplication)
Parameters
application
the UIApplication object
-
When PredixMobilityConfiguration.automaticallyListenForApplicationStateEvents is false, this method can be used to inform the SDK of the applicationWillEnterForeground event from a consuming application.
Would be called by the container’s AppDelegate, example:
func applicationWillEnterForeground(_ application: UIApplication) { PredixMobilityManager.sharedInstance.applicationDelegates.applicationWillEnterForeground(application) }
Declaration
Swift
public func applicationWillEnterForeground(_ application: UIApplication)
Parameters
application
the UIApplication object
-
Allows the SDK to handle local iOS notifications, informing the running webapp when they occur.
Should be called by the container’s AppDelegate, example:
func application(_ application: UIApplication, didReceive notification: UILocalNotification) { PredixMobilityManager.sharedInstance.application(application, didReceiveLocalNotification: notification) }
Declaration
Swift
public func application(_ application: UIApplication, didReceiveLocalNotification notification: UILocalNotification)
Parameters
application
the UIApplication object
didReceiveLocalNotification
the notification object
-
Allows the SDK to handle remote push notifications, informing the running webapp when they occur.
Should be called by the container’s AppDelegate, example:
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any]) { PredixMobilityManager.sharedInstance.application(application, didReceiveRemoteNotification: userInfo) }
Declaration
Swift
public func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any])
Parameters
application
The UIApplication object.
userInfo
Dictionary containing information about the remote notification.
-
Allows the SDK to handle registration of remote push notifications.
Registration information will be written to a Database document where it can be processed by the server to register the device for remote notifications.
Should be called by the container’s AppDelegate, example:
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { PredixMobilityManager.sharedInstance.application(application, didRegisterForRemoteNotificationsWithDeviceToken: deviceToken) }
Declaration
Swift
public func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data)
Parameters
application
The UIApplication object.
deviceToken
A token that identifies the device to APNs.
-
Allows the SDK to handle failures in obtaining a remote push notification device token.
Should be called by the container’s AppDelegate, example:
func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) { PredixMobilityManager.sharedInstance.application(application, didFailToRegisterForRemoteNotificationsWithError: error as NSError) }
Declaration
Swift
public func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error)
Parameters
application
The UIApplication object.
error
Error object.