Comment on page
Utility Methods (iOS)
Explore the iOS utility methods related to location permissions.
The Roam SDK is capable of sending push notifications to your users. Click here to get the device token.
Swift
Objective-C
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
Roam.setDeviceToken(deviceToken)
}
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
[Roam setDeviceToken:deviceToken];
}
Check if the location permissions for the app are enabled.
Swift
Objective-C
Roam.isLocationEnabled()
[Roam isLocationEnabled];
By using the
locationPermissionStatus
method you can check the location permission status.Swift
Objective-C
Roam.locationPermissionStatus()
[Roam locationPermissionStatus];
notDetermined = 0
restricted = 1
denied = 2
authorizedAlways = 3
authorizedWhenInUse = 4
Application request for the user location.
Swift
Objective-C
Roam.requestLocation()
[Roam requestLocation];
Check whether location tracking has started or not. This method returns a boolean value.
Swift
Objective-C
Roam.isLocationTracking()
[Roam isLocationTracking];
By using this method inside the Notification delegate method you can track the campaign's impressions and counts.
Swift
Objective-C
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void)
{
Roam.notificationOpenedHandler(response)
completionHandler()
}
- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler{
[Roam notificationOpenedHandler:response];
}
Last modified 1mo ago