Skip to main content

Flutter

This page describes how to migrate your application from using PinchSDK to stable release of Kettle.

Replace plugin

  1. Remove the pinch plugin.
  2. Add kettle: ^1.0.0 as a dependency.
  3. Run flutter pub get.

Replace meta-data in AndroidManifest.xml

  1. Key com.fluxloop.pinch.sdk.API_KEY has been renamed to com.kogenta.kettle.API_KEY.
  2. Key com.fluxloop.pinch.sdk.PRODUCTION_MODE has been renamed to com.kogenta.kettle.PRODUCTION_MODE.

Replace imports

Replace import 'package:pinch/pinch.dart'; with import 'package:kettle/kettle.dart';

Replace initialization code for iOS in AppDelegate.m

Replace

import PinchSDK

PinchSDK.initialize(with: launchOptions)
PinchSDK.apiKey = "api-key-here"

with

AppDelegate.swift
import KettleKit
...

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
...

let kettleConfig = KettleConfig.default()
kettleConfig.developmentApiKey = "<DEVELOPMENT-API-KEY>"
kettleConfig.productionApiKey = "<PRODUCTION-API-KEY>"

Kettle.prepare(config, launchOptions: launchOptions)
...
}

Pinch.grant()

Grant no longer accepts a single value. Merge all instances of await Pinch.grant() into a single grant:

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

Pinch.revoke()

Revoke no longer accepts a single value. Merge all instances of await Pinch.revoke() into a single revoke:

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

Pinch.getGrantedConsents()

Replaced by Kettle.getGrantedConsents()

Pinch.start(), Pinch.startBluetoothProvider(), Pinch.startLocationProvider(), Pinch.startMotionProvider()

  • These methods are no longer called individually. They are enabled in a single method call.
  • Modules must be explicitly started.
  • The Kettle.getEnabledModules() method has been added to read which modules are currently enabled in Kettle.
await Kettle.start([
KettleModule.location,
KettleModule.bluetooth,
KettleModule.activity
]);

Pinch.stop(), Pinch.stopBluetoothProvider(), Pinch.stopLocationProvider(), Pinch.stopMotionProvider()

  • These methods are no longer called individually. They can be disabled in a single method call.
await Kettle.stop([
KettleModule.location,
KettleModule.bluetooth,
KettleModule.activity
]);

Pinch.setAdId()

This method no longer exists.

Pinch.getStarted()

Replaced by Kettle.isStarted().

Pinch.sendDemographicProfile()

Replaced by Kettle.sendDemographicProfile().

Pinch.addCustomData()

Replaced by Kettle.addCustomData().

Pinch.setMetadata()

Replaced by Kettle.setMetadata().

Pinch.getPrivacyTermsUrl()

This method no longer exists.

Pinch.getPrivacyDashboard(consent)

Replaced by parameterless Kettle.getPrivacyDashboardUrl().

Pinch.requestBluetoothPermission()

This method no longer exists.

Pinch.requestMotionPermission()

This method no longer exists.

Pinch.deleteCollectedData()

Replaced by Kettle.deleteCollectedData().

PinchMessage

Replaced by KettleMessage.

Pinch.getMessages()

Replaced by Kettle.getMessages().