The Airship Gimbal Adapter is a drop-in class that allows users to integrate Gimbal place events with Airship.
- Gimbal Developer Guide
- Gimbal Manager Portal
- Airship Getting Started guide
- Airship and Gimbal Integration Guide
The Airship Gimbal Adapter is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "GimbalAirshipAdapter"
import AirshipAdapter
@import AirshipAdapter
By default, event tracking is disabled, and thus must be explicitly enabled as described below.
To enable or disable the tracking of Airship RegionEvent objects, use the shouldTrackRegionEvents property:
AirshipAdapter.shared.shouldTrackRegionEvents = true // enabled
AirshipAdapter.shared.shouldTrackRegionEvents = false // disabled
To enable or disable the tracking of Airship CustomEvent objects, use the shouldTrackCustomEntryEvents and shouldTrackCustomExitEvents properties to track events upon place entry and exit, as shown below. For more information regarding Airship Custom Events, see the documentation here.
// To enable CustomEvent tracking for place exits
AirshipAdapter.shared.shouldTrackCustomExitEvents = true
// To disable CustomEvent tracking for place exits
AirshipAdapter.shared.shouldTrackCustomExitEvents = false
// To enable CustomEvent tracking for place entries
AirshipAdapter.shared.shouldTrackCustomEntryEvents = true
// To disable CustomEvent tracking for place entries
AirshipAdapter.shared.shouldTrackCustomEntryEvents = false
In your application delegate call restore during didFinishLaunchingWithOptions:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
// after Airship.takeOff
AirshipGimbalAdapter.shared.restore()
...
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// after UAirship.takeOff
[[AirshpGimbalAdapter shared] restore];
...
}
Restore will automatically resume the adapter on application launch.
AirshipGimbalAdapter.shared.start("## PLACE YOUR API KEY HERE ##")
[[AirshpGimbalAdapter shared] start:@"## PLACE YOUR API KEY HERE ##"];
AirshipGimbalAdapter.shared.stop()
[[AirshpGimbalAdapter shared] stop];
In the event that Bluetooth is disabled during place monitoring, the Gimbal Adapter can prompt users with an alert view
to enable Bluetooth. This functionality is disabled by default, but can be enabled by setting AirshipGimbalAdapter's
bluetoothPoweredOffAlertEnabled property to true:
AirshipGimbalAdapter.shared.bluetoothPoweredOffAlertEnabled = true
[AirshpGimbalAdapter shared].bluetoothPoweredOffAlertEnabled = YES;
AirshipAdapter.shared.set(userAnalyticsId: "YOUR_ANALYTICS_ID")
The AirshipGimbalAdapter is an older version of this adapter; if you previously used the AirshipGimblAdapter and would like to migrate, see the following steps:
- If using Cocoapods, change the name of the pod from
AirshipGimbalAdaptertoGimbalAirshipAdapter - In your code, references to the
AirshipGimbalAdapterclass should be changed toAirshipAdapter - The older
AirshipGimbalAdaptertracked Region Events but not Custom Events; if you would like to keep this type of functionality, disableCustomEventtracking and enableRegionEventtracking, as described above in the section entitledEnabling Event Tracking.