Deliver Great Mobile Apps with the Kontakt.io iOS SDK for Xamarin

Deliver Great Mobile Apps with the Kontakt.io iOS SDK for Xamarin

If you’re a fan of the Xamarin platform, you’re going to love our iOS SDK Xamarin-enable component.
(Download our component here!)
Here’s a quick overview of SDK and how to get started.

Connecting Offline and Online Worlds

Kontakt.io iOS SDK for Xamarin enables quick integration of Kontakt.io iBeacon and Eddystone beacons into any application written on Xamarin platform. It provides the same functionality as the native iOS SDK, giving developers access to all capabilities of the Kontakt.io platform.

Notable Features

  • iBeacon monitoring and ranging
  • Eddystone beacons detection
  • Beacon health reporting
  • API client
  • Configuring Kontakt.io devices
  • Configuration

To get started, set your API key in AppDelegate‘s FinishedLaunching method:

Kontakt.APIKey = "YOUR-API-KEY";

Beacon Manager

KTKBeaconManager is the main class responsible for handling iBeacon monitoring and ranging.

Permissions

iBeacon support on iOS is a part of Location Services. When it comes to monitoring and ranging, Kontakt.io iOS SDK is built on top of Core Location. Because of this, before you start monitoring you need to make sure your app has the necessary permission to use Location Services and ask for them if needed.

Due to permission requirements, you must specify NSLocationAlwaysUsageDescription or NSLocationWhenInUseUsageDescription in your info.plist file with a description that will be prompted to your users. Then while using BeaconManager, you should first call either RequestLocationAlwaysAuthorization or RequestLocationWhenInUseAuthorization.

Example

The example below presents beacons monitoring and ranging functionality.

Eddystone Manager

Since Core Location is not aware of Eddystone beacons, a separate manager on Kontakt.io iOS SDK detects them. In order to start working with Eddystone beacons you need to initialize a KTKEddystoneManager instance with a delegate object that conforms to KTKEddystoneManagerDelegate protocol.

Nearby Devices Manager

An object in your app responsible for detecting and connecting to nearby Kontakt.io devices needs to be an instance of a KTKDevicesManager class. Under the hood, KTKDevicesManager depends on Core Bluetooth to find Bluetooth devices and establish connection with your beacons when needed.

In order to detect nearby devices, you can use the sample code below:

Applying a New Configuration

If you want to change your beacon settings, you need to use a connection to a beacon to write a new configuration, which is an instance of KTKDeviceConfiguration class. A new configuration can be made on the go, directly in your own app. It’s just a matter of setting up a KTKDeviceConfiguration and then providing new values to that object’s properties that correspond with the beacon settings you want to adjust. Another approach is to create a configuration through Web Panel or API. Please check examples from the API Client section to learn how to get pending configurations from Kontakt.io Cloud.

Below you can find a simple example of how to apply new configuration to a device:

API Client

The Kontakt.io Cloud API provides a series of resources to query/update our Cloud Services. Information that you can either access or modify in Kontakt.io Web Panel is also available through API for our backend.

Class responsible for communication with that API is the KTKCloudClient. Most data that you can get from or modify through an API call has an equivalent in one of the SDK classes. Here’s an example:

Ready to start developing great apps? Download our component today!

Hannah Augur - Photo
Content writer / tech blogger / geek based in Berlin. Hannah reports on all things tech and has a medium-sized tolerance for buzzwords.

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Review our cookies information for more details.