Skip to main content

Configuration

You will need to configure the Sahha SDK before you can use it.

Configure the SDK immediately

The Sahha SDK must be configured immediately on app launch.


Configure

Choose your specific platform from the options below.

MyApp.swift
import SwiftUI
import Sahha

@main
struct MyApp: App {

// Configure Sahha inside `init` of your app's `App` view.

init() {
let settings = SahhaSettings(environment: .sandbox)
Sahha.configure(settings) {
// SDK is ready to use
print("SDK Ready")
}
}

var body: some Scene {
WindowGroup {
ContentView()
}
}

}

Environment Settings

The SahhaEnvironment determines if the SDK connects to the sandbox or production server of the API.

SahhaEnvironmentDescription
sandboxFor testing and debugging
productionFor public release on the App Store / Google Play
Setting the incorrect environment will send data to the wrong server!
  • Always use sandbox during development of your app.
  • Only use production when releasing your app to public users (not for internal testing).
public enum SahhaEnvironment: String {
case sandbox
case production
}

Sensor Settings

You can specify which sensors for the Sahha SDK to use. To optimize your analysis result, we suggest enabling all sensors. Leave this value null to enable all sensors by default.

Some sensors are not available on all platforms.

SahhaSensorDescriptionAndroidiOS
sleepFor tracking sleep patterns
pedometerFor tracking walking patterns
deviceFor tracking device usage patternsX
heartFor tracking heart patterns (rate, variability)X
bloodFor tracking blood patterns (pressure, glucose)X
public enum SahhaSensor: String, CaseIterable {
case sleep
case pedometer
case device
case heart
case blood
}

Notifications

You can customize notifications for any platform that includes an Android app.

You can customize notifications for the following platforms:
  • Android
  • Flutter (Android only)
  • React Native (Android only)

iOS apps not supported


Custom Notification Icon

You can add an optional custom notification icon to your Android app.

How to create app icons with Image Asset Studio

Step 1) Open your project in Android Studio.

Step 2) With the app folder highlighted, selectFileNewImage Asset.

Step 3) Select Notification Icons for Icon Type, enter a Name, select Image as Asset Type and alter the Padding as desired.

Step 4) This page can typically be left as it is. Select Finish.


Custom Notification Settings

You can specify optional custom notificationSettings. If notificationSettings are not specified, then the app will use the default notification settings.

Android
val notificationSettings = SahhaNotificationConfiguration(
icon = R.drawable.ic_test, // The icon id must match the filename you add to the project
title = "Custom Title",
shortDescription = "Custom description",
)

Default Notification Settings

If custom notificationSettings are not specified, then the app will use the default notification settings. If custom notificationSettings are only partially specified, then the app will use the default notification settings.The app will fill in the missing notification parameters with default values. E.g. if an icon and title are provided but a shortDescription is not, then the shortDescription will use the default value.

Android
val icon = R.drawable.ic_sahha_no_bg // The Sahha logo
val title = "Analytics are running"
val shortDescription = "Swipe for options to hide this notification."