Skip to content

Managing user consent

Pushwoosh supports compliance with privacy regulations (e.g., GDPR, CCPA) by allowing developers to control when the SDK begins communication with Pushwoosh servers. This allows to ensure that no data is collected before the user gives explicit consent.

By default, the Pushwoosh SDK begins communication and collecting device data immediately upon initialization. However, you can change this behavior so that no communication happens until the user gives consent.

With this setup:

  • If the user gives consent, the SDK initializes and begins collecting data.

  • If the user does not give consent, the SDK stays inactive and does not collect any data.

  • If the user later withdraws consent, the SDK stops all activity and disconnects from the servers.

Pushwoosh provides mechanisms to manage this flow in iOS, Android, and Unity.

By default, the communication with the SDK is enabled. To disable all communication with Pushwoosh servers until consent is explicitly granted by the user, add the following key to your Info.plist:

<key>Pushwoosh_ALLOW_SERVER_COMMUNICATION</key>
<false/>

Use the following methods to determine if communication is currently allowed:

import SwiftUI
import PushwooshFramework
var serverCommunicationAllowed = PWCoreServerCommunicationManager.sharedInstance.isServerCommunicationAllowed
print("isServerCommunicationAllowed: ", serverCommunicationAllowed)

Once the user has granted consent, enable communication as follows:

import SwiftUI
import PushwooshFramework
Pushwoosh.sharedInstance().startServerCommunication()

Once communication is enabled, explicitly register for push notifications:

import SwiftUI
import PushwooshFramework
Pushwoosh.sharedInstance().registerForPushNotifications()

To stop communication with Pushwoosh servers (e.g., if the user revokes consent):

import SwiftUI
import PushwooshFramework
Pushwoosh.sharedInstance().stopServerCommunication()

By default, communication is enabled. To prevent any data from being sent to Pushwoosh servers until user consent is obtained, add the following to your AndroidManifest.xml:

<meta-data
android:name="com.pushwoosh.allow_server_communication"
android:value="false" />

Use the following methods to determine if server communication is currently allowed:

import com.pushwoosh.Pushwoosh;
boolean isCommunicationEnabled = Pushwoosh.getInstance().isServerCommunicationAllowed();
Log.d("Pushwoosh", "Communication enabled = " + isCommunicationEnabled);

Once the user has granted consent, enable communication as follows:

import com.pushwoosh.Pushwoosh;
Pushwoosh.getInstance().startServerCommunication();

After communication is enabled, explicitly register for push notifications:

import com.pushwoosh.Pushwoosh;
Pushwoosh.getInstance().registerForPushNotifications();

To stop communication with Pushwoosh servers (e.g., if the user revokes consent):

import com.pushwoosh.Pushwoosh;
Pushwoosh.getInstance().stopServerCommunication();

By default, the communication with the SDK is enabled. To disable all communication with Pushwoosh servers until consent is explicitly granted by the user, apply platform-specific settings:

Android

Add the following to your Unity project at AndroidManifest.xml:

<meta-data android:name="com.pushwoosh.allow_server_communication" android:value="false" />

iOS

Modify Info.plist:

<key>Pushwoosh_ALLOW_SERVER_COMMUNICATION</key>
<false/>

Note: You must enable communication before calling RegisterForPushNotifications.

Use the following method to check whether server communication is currently allowed:

bool enabled = Pushwoosh.Instance.IsCommunicationEnabled();

To enable communication after consent:

Pushwoosh.Instance.SetCommunicationEnabled(true);

Once communication is enabled, you can register the device for push notifications:

Pushwoosh.Instance.RegisterForPushNotifications();

To stop communication with Pushwoosh servers (e.g., if the user revokes consent):

Pushwoosh.Instance.SetCommunicationEnabled(false);