Installation

  1. Ensure you have CocoaPods 1.1.0 or later
  2. Ensure you have use_frameworks! in your Podfile
  3. Add DittoSwift to your Podfile like so:
pod 'DittoSwift'
# Note: ensure it is `DittoSwift` and NOT `DittoObjc`. `DittoObjc` is for Objective-C projects
  1. Add these keys in your Info.plist

Since iOS 13 and Xcode 11 an app must ask the user's permission to use Bluetooth. Ditto will activate Bluetooth by default, which means the user will receive a permission prompt automatically.

You must include several keys in the Info.plist file your app.

  • Privacy - Local Network Usage Description
  • Privacy - Bluetooth Peripheral Usage Description
  • Privacy - Bluetooth Always Usage Description
  • A Bonjour service _http-alt._tcp.
<key>NSBluetoothAlwaysUsageDescription</key>
<string>Uses Bluetooth to connect and sync with nearby devices</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>Uses Bluetooth to connect and sync with nearby devices</string>
<key>NSLocalNetworkUsageDescription</key>
<string>Uses WiFi to connect and sync with nearby devices</string>
<key>NSBonjourServices</key>
<array>
  <string>_http-alt._tcp.</string>
</array>
  1. Set your license token like below. We inside your AppDelegate.swift's didFinishLaunchingWithOptions
let ditto = Ditto()
self.ditto.setAccessLicense("<ditto_license_token>")
  1. Ensure you have CocoaPods 1.1.0 or later
  2. Ensure you have use_frameworks! in your Podfile
  3. Add DittoObjC to your Podfile like so:
pod 'DittoObjC'
# Note: ensure it is `DittoObjC` and NOT `DittoSwift`. `DittoSwift` is for Swift projects
  1. Add these keys in your Info.plist

Since iOS 13 and Xcode 11 an app must ask the user's permission to use Bluetooth. Ditto will activate Bluetooth by default, which means the user will receive a permission prompt automatically.

You must include several keys in the Info.plist file your app.

  • Privacy - Local Network Usage Description
  • Privacy - Bluetooth Peripheral Usage Description
  • Privacy - Bluetooth Always Usage Description
  • A Bonjour service _http-alt._tcp.
<key>NSBluetoothAlwaysUsageDescription</key>
<string>Uses Bluetooth to connect and sync with nearby devices</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>Uses Bluetooth to connect and sync with nearby devices</string>
<key>NSLocalNetworkUsageDescription</key>
<string>Uses WiFi to connect and sync with nearby devices</string>
<key>NSBonjourServices</key>
<array>
  <string>_http-alt._tcp.</string>
</array>
  1. Set your license token like below. We inside your AppDelegate.m's didFinishLaunchingWithOptions
DITDitto *ditto = [[DITDitto alloc] init];
[ditto setAccessLicense: @"<ditto_license_token>"];
  1. Ensure your device has Android 7.1 or higher
  2. Ensure that jcenter is in the project level build.gradle file like so:
buildscript {
    repositories {
        jcenter()
    }
}
  1. In the individual module build.gradle file add:
dependencies {
    // ...
    implementation "live.ditto:ditto:latest.release"
}

android {
    // ...

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}
  1. Configure your manifest like so:
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
  1. Register your license code like below. We recommend placing this in your Application.onCreate method
val androidDependencies = DefaultAndroidDittoDependencies(applicationContext)
val ditto = Ditto(androidDependencies)
ditto.setAccessLicense("<ditto_license_token>")
  1. Ensure your device has Android 7.1 or higher
  2. Ensure that jcenter is in the project level build.gradle file like so:
buildscript {
    repositories {
        jcenter()
    }
}
  1. In the individual module build.gradle file add:
dependencies {
    // ...
    implementation "live.ditto:ditto:latest.release"
}

android {
    // ...

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}
  1. Configure your manifest like so:
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
  1. Register your license code like below. We recommend placing this in your Application.onCreate method
DefaultAndroidDittoDependencies androidDependencies = new DefaultAndroidDittoDependencies(applicationContext);
Ditto ditto = new Ditto(androidDependencies);
ditto.setAccessLicense("<ditto_license_token>");
Top