# Usage

# Pinch

# Available consents

PinchConsent.SURVEYS
PinchConsent.ANALYTICS
PinchConsent.CAMPAIGNS
PinchConsent.ADS
1
2
3
4

# Granting consents

Accepts a list of consents.

Pinch.grant([PinchConsent.ANALYTICS, PinchConsent.SURVEYS]);
1

# Revoking consents

Accepts a list of consents.

Pinch.revoke([PinchConsent.ANALYTICS, PinchConsent.SURVEYS]);
1

# Retrieve granted consents

Returns a list of numbers. Can be compared against PinchConsent if necessary.

Pinch.getGrantedConsents().then(consents => console.log(consents));
1

# Request Permissions

Use default APIs to request permissions like notification, location and bluetooth where needed. For iOS make sure to request location when in use and always in separate steps to ensure the user get the dialogs within the app context.

// Bluetooth Permission is only needed from iOS 12+ and is granted by default prior to this
if (Platform.OS == "ios" && parseInt(Platform.Version, 10) > 12) {
    request(PERMISSIONS.IOS.BLUETOOTH_PERIPHERAL).then(result => {
        console.warn(result)
    })
} else {
    console.warn("Permissions not required.")
}
1
2
3
4
5
6
7
8

# Start SDK

Pinch.start();
1

Note

The SDK will remember that it has been started, and subsequent calls to is unneccessary. If user clears or deletes app data, start has to be called again.

# Stop SDK

Pinch.stop();
1

# Retrieve SDK status

Returns a boolean.

Pinch.isStarted().then(started => console.log(started));
1

# Send demographic profile

Used to send birth year and gender of user to the Pinch Network. Method accepts a year and gender.

Pinch.sendDemographicProfile(1995, PinchGender.MALE);

// available genders: PinchGender.MALE, PinchGender.FEMALE, PinchGender.UNKNOWN
1
2
3

::: ::::

# Send custom data

WARNING

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

# Send metadata

WARNING

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

Note

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

# Push tokens

MessagingId is the ID used by the Pinch Platform for sending notifications to the device (eg. FCM registration id). This can be done by calling:

# Retrieve privacy terms URL

The URL for privacy terms can be retrieved by calling:

# Retrieve privacy dashboard URL

The URL for the privacy dashboard, which contains all collected data for given consent, can be retrieved by calling:

# Deleted collected PII & data

You can delete all PII and collected data about a user by calling this method.

# Pinch Messaging Center

Retrieve incoming messages to user from Pinch.

Note

All fields in PinchMessage except created, expiry and opened is nullable.