# Migrate from PureSDK v1 to PinchSDK v2

This page describes how to migrate your application from using PureSDK to PinchSDK.

# Before you begin

This guide assumes that you fulfill the requirements to implement PinchSDK.

Requirements:

# Android

# Step 1: Replace existing gradle references

In your app's build.gradle, replace the following maven repository

maven {
    credentials {
        username "<USERNAME>"
        password "<PASSWORD>"
    }
    url 'https://puresdk.azurewebsites.net/artifacts/'
}
1
2
3
4
5
6
7

with

maven { url = "https://dl.bintray.com/fluxloop/pinch" }
1

# Step 2: Replace dependencies & ProGuard Definitions

In your app's build.gradle, replace the dependency 'com.pure:sdk:1.x.x' with 'com.fluxloop.pinch:pinch-sdk:x.x.x'. See the android implementation guide for latest available version. The implementation guide also describes how to enable Java 8 byte code, if this is disabled in your project.

Remove the following dependencies if you are not using them in your application: com.google.android.gms:play-services-ads and com.google.android.gms:play-services-awareness.

If you are using proguard, replace the following proguard definition:

-keepclassmembers class com.pure.internal.models.** { *; }
1

with

-keep class com.fluxloop.pinch.core.model.** { *; }
-keep class com.fluxloop.pinch.common.model.** { *; }
1
2

# Step 3: Initialize PinchSDK

IMPORTANT

A runtime exception will be thrown if API key is missing during application launch.

In AndroidManifest.xml, add the following element as a child of the <application> element, by inserting it just before the closing </application> tag:

Remove any remanining reference to com.pure.sdk in your AndroidManifest.xml.

# Step 4: Replace API calls

Look at this page to see all of the new methods available in PinchSDK.

Rest of this section will contain a link to the method that should replace your existing api calls to PureSDK.

# Pure.init(...)

Method removed.

# Pure.startTracking()

Method replaced by Pinch.start().

# Pure.stopTracking()

Method replaced by Pinch.stop().

# Pure.getClientId(...)

Method removed.

# Pure.associateMetadata(...)

Method replaced by Pinch.setMetadata(...).

Are you using this method to send us birthYear and gender? Replace it with Pinch.sendDemographicProfile(...)

# Pure.createEvent(...)

Method replaced by Pinch.addCustomEvent(...).

# Pure.createEvent("Privacy", { deletePersonalData: true })

Method replaced by Pinch.deleteCollectedData().

# iOS

# Step 1: Replace existing CocoaPods reference

In your Podfile, replace pod 'PureSDK', :podspec => 'xxx' with pod 'PinchSDK', '1.1.9'. See the iOS implementation guide for latest version available, or use CocoaPods to update.

In your Podfile, remove pod 'PureSDKBluetooth', :podspec => 'xxx'.

# Step 2: Replace API calls

Look at this page to see all of the new methods available in PinchSDK. Replace Pinch in method calls with PinchX if your project is Obj-C. Rest of this section will contain a link to the method that should replace your existing api calls to PureSDK.

# [Pure initializeWithLaunchOptions:launchOptions]

Method replaced by Pinch.initialize(...).

# [Pure startTracking]

Method replaced by Pinch.start().

# [Pure stopTracking]

Method replaced by Pinch.stop().

# [Pure createEventWithType:...]

Method replaced by Pinch.addCustomData(...).

# [Pure associateMetadataWithType:...]

Method replaced by Pinch.setMetadata(...).

Are you using this method to send us birthYear and gender? Replace it with Pinch.sendDemographicProfile(...).

# Delete data

Method replaced by Pinch.deleteCollectedData().