Roam.ai Docs
Roam v1
Ask or search…
K
Links
Comment on page

Utility Methods (iOS)

Explore the iOS utility methods related to location permissions.

Set DeviceToken

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 Location Permission

Check if the location permissions for the app are enabled.
Swift
Objective-C
Roam.isLocationEnabled()
[Roam isLocationEnabled];

Location Permission Status

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

Request Location Permission

Application request for the user location.
Swift
Objective-C
Roam.requestLocation()
[Roam requestLocation];

Check Location Tracking

Check whether location tracking has started or not. This method returns a boolean value.
Swift
Objective-C
Roam.isLocationTracking()
[Roam isLocationTracking];

Notification Opened Handler

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];
}