Skip to main content

Usage

Kettle

Consents

KettleConsent.surveys
KettleConsent.analytics
KettleConsent.campaigns
KettleConsent.ads

Granting consents

Defines what the data collected from the user can be used for.

await Kettle.grant([KettleConsent.surveys, KettleConsent.analytics, KettleConsent.campaigns, KettleConsent.ads]);

Revoking consents

Removes previously granted user consent.

await Kettle.revoke([KettleConsent.surveys, KettleConsent.analytics, KettleConsent.campaigns, KettleConsent.ads]);

Retrieve granted consents

Returns an array containing the consents granted to Kettle.

await Kettle.getGrantedConsents();

Start Kettle

Starts collecting data for given modules. This method can -not- be called without modules.

await Kettle.start([
KettleModule.location,
KettleModule.bluetooth,
KettleModule.activity
]);

Stop Kettle

Stops collecting data from given modules.

await Kettle.stop([
KettleModule.location,
KettleModule.bluetooth,
KettleModule.activity
]);

Retrieve enabled modules

await Kettle.getEnabledModules();

Retrieve motion data

// parameters are fromTime and toTime. These are specified in milliseconds since unix epoch.
await Kettle.getActivityEvents(0, 0)

Retrieve SDK status

Returns true if Kettle is currently enabled and collecting data.

await Kettle.isStarted();

Assign push token

Forwards the users push token to Kettle, allowing it to send push notifications.

await Kettle.setPushToken("push-token");

Assign external identifier

Forwards the users internal user ID to Kettle, allowing Kogenta to map your internal identifier with the users Kettle ID.

await Kettle.setExternalId("external-id");

Kettle Identifier

Returns the internal Kettle ID for the user.

await Kettle.getIdentifier();

Send demographic profile

Returns the internal Kettle ID for the user.

await Pinch.sendDemographicProfile(1995, "male");

// available genders: "male", "female", "unknown"

Send custom data

::: warning This function only accepts stringified json. If anything else is supplied, a swallowed exception will be thrown. :::

String type = "order";
String json = "{\"orderId\": \"12\", \"items\": [1, 2, 3]}";
await Pinch.addCustomEvent(type, json);

Send metadata

::: warning This function only accepts stringified json. If anything else is supplied, a swallowed exception will be thrown. :::

::: tip Note This method performs a PUT request, replacing any previous values sent with the same type. :::

let type = "name";
let json = "{\"nickname\": \"jas\"}";
await Pinch.setMetadata(type, json);

Privacy dashboard URL

The URL for the Kogenta Privacy Dashboard. This site can be used to view all data collected by Kettle, exporting data and request deletion of data.

await Kettle.getPrivacyDashboardUrl();

Delete collected PII & Data

Calling this method will request deletion of all data collected by Kettle for the user. This method will delete all data currently residing on the device, as well as request deletion of data in cloud. It requires an active internet connection and accepts an optional closure that can be used to verify that the deletion request was successfully sent.

await Kettle.deleteCollectedData();

Kettle Messaging Center

Retrieve incoming messages to user from Pinch.

::: tip Note All fields in KettleMessage except created, expiry and opened is nullable. :::

List<KettleMessage> messages = await Kettle.getMessages();

Kettle Motion Tracking

Android

Add the following permission to your applications manifest: <uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION"/>

If your application targets Android 9 (API level 28) or lower, the system will auto-grant the required permission as long as the permission line is present in manifest. If you're application targets an API level higher than 28, you need to explicity request Manifest.permission.ACTIVITY_RECOGNITION during onboarding. If this doesn't work, you may have to explicitly request com.google.android.gms.permission.ACTIVITY_RECOGNITION instead.

iOS

Add the following key and value to your applications Info.plist:

<key>NSMotionUsageDescription</key>
<string>Text to show in system dialog during permission request</string>

Motion data will be collected alongside location updates, which requires the location provider to be enabled.