Getting Started

Here’s a quick, 5-minute setup guide for integrating the SDK.

Create a New Project

  1. In the webapp, create a new project which can house related apps across different platforms (iOS, Android).

    Create Fritz Project

    Creating a new project

  2. After you’ve created the project, you’ll be asked to create your first app. You’ll receive instructions to install and configure the Fritz Core SDK in your app before using features or custom models. For reference, the instructions are shown below.

    Add App to Project

    Adding an app to your project

Note

Your Bundle/Package ID (e.g. com.example.app) must match the ID of the app you are using with the SDK.


iOS

Prerequisites

You’ll need the following before you can begin:

  • Xcode 9.3 or later.
  • Xcode project targeting iOS 10 or above. You will only be able to use features in iOS 11+, but you still can include Fritz in apps that target iOS 10+ and selectively enable for users on 11+.
  • Swift projects must use Swift 4.1 or later.
  • CocoaPods 1.4.0 or later.
  • The bundle identifier of your app.

Installing the SDK

Add the Fritz SDK to your app using the following instructions. Before you add the SDK, you’ll need to create a new project.

1. Add the SDK via CocoaPods

  • Create a Podfile if you don’t have one: $ pod init.
  • Open your Podfile and add: $ pod 'Fritz'.
  • Save the file and run: $ pod install.

This creates a .xcworkspace file for your app. Use this file for all future development on your application.

2. Make sure your app is registered with Fritz

After creating a project, you must register your app. If you have not done so, you can add an app from the Project Overview page.

3. Add Fritz-Info.plist to your app

Add the Fritz-Info.plist file to your app. Make sure to include it in all targets.

If you do not have the Fritz-Info.plist file, you can download it from the Project Settings page for your project. Click the plus button on the appropriate app and download.

4. Initialize in AppDelegate

Initialize the SDK with your api key. Afterward you’ll be able to use features or add your own custom models.

import UIKit
import Fritz

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

  var window: UIWindow?

  func application(_ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?)
    -> Bool {
    FritzCore.configure()
    return true
  }
}

Android

If you have not yet created a project and app yet, please follow the instructions to Create a New Project. Before you can use Fritz features, you must register your app with Fritz. The below instructions give an overview, but you still need to get specific API keys from the webapp.

1. Add the SDK

You can add the SDK using gradle.

Add our repository in order to download libraries:

repositories {
    maven { url "https://raw.github.com/fritzlabs/fritz-repository/master" }
}

Add the gradle dependencies:

dependencies {
    implementation 'ai.fritz:core:1.0.1'
}

2. Add the api key to your Android Manifest

Edit your app’s AndroidManifest.xml to include the fritz_api_key and INTERNET permissions.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ai.fritz.fritzsdkapp">
    /*
      ----------------------------------------------
         Internet permissions
      ----------------------------------------------
    */
    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:allowBackup="false"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        /*
          ------------------------------------
            Include the Fritz api key
          ------------------------------------
         */
        <meta-data android:name="fritz_api_key" android:value="<API Key from Webapp>" />
         /*
          -----------------------------
                      END
          -----------------------------
         */
    </application>
</manifest>

Replace fritz_api_key with the API key from the webapp. You can find the proper API key from the Project Settings page in the webapp.

3. Initialize the SDK onCreate

In your Application or MainActivity class, initialize SDK.

public class MainActivity extends AppCompatActivity {
    ...
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        Fritz.configure(this);
}