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.
Overview
Section titled “Overview”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.
Disable SDK server communication at startup
Section titled “Disable SDK server communication at startup”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/>
Check communication status
Section titled “Check communication status”Use the following methods to determine if communication is currently allowed:
import SwiftUIimport PushwooshFramework
var serverCommunicationAllowed = PWCoreServerCommunicationManager.sharedInstance.isServerCommunicationAllowedprint("isServerCommunicationAllowed: ", serverCommunicationAllowed)
import PushwooshFramework
var serverCommunicationAllowed = PWCoreServerCommunicationManager.sharedInstance.isServerCommunicationAllowedprint("isServerCommunicationAllowed: ", serverCommunicationAllowed)
#import <PushwooshFramework/PushwooshFramework.h>
BOOL serverCommunicationAllowed = [PWCoreServerCommunicationManager sharedInstance].isServerCommunicationAllowed;NSLog(@"isServerCommunicationAllowed: %d", serverCommunicationAllowed);
Enable SDK communication after consent
Section titled “Enable SDK communication after consent”Once the user has granted consent, enable communication as follows:
import SwiftUIimport PushwooshFramework
Pushwoosh.sharedInstance().startServerCommunication()
import PushwooshFramework
Pushwoosh.sharedInstance().startServerCommunication()
#import <PushwooshFramework/PushwooshFramework.h>
[[Pushwoosh sharedInstance] startServerCommunication];
Register for push notifications
Section titled “Register for push notifications”Once communication is enabled, explicitly register for push notifications:
import SwiftUIimport PushwooshFramework
Pushwoosh.sharedInstance().registerForPushNotifications()
import PushwooshFramework
Pushwoosh.sharedInstance().registerForPushNotifications()
#import <PushwooshFramework/PushwooshFramework.h>
[[Pushwoosh sharedInstance] registerForPushNotifications];
Disable communication
Section titled “Disable communication”To stop communication with Pushwoosh servers (e.g., if the user revokes consent):
import SwiftUIimport PushwooshFramework
Pushwoosh.sharedInstance().stopServerCommunication()
import PushwooshFramework
Pushwoosh.sharedInstance().stopServerCommunication()
#import <PushwooshFramework/PushwooshFramework.h>
[[Pushwoosh sharedInstance] stopServerCommunication];
Android
Section titled “Android”Disable SDK server communication at startup
Section titled “Disable SDK server communication at startup”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" />
Check communication status
Section titled “Check communication status”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);
import com.pushwoosh.Pushwoosh
val isCommunicationEnabled = Pushwoosh.getInstance().isServerCommunicationAllowed()Log.d("Pushwoosh", "Communication enabled = $isCommunicationEnabled")
Enable SDK communication after consent
Section titled “Enable SDK communication after consent”Once the user has granted consent, enable communication as follows:
import com.pushwoosh.Pushwoosh;
Pushwoosh.getInstance().startServerCommunication();
import com.pushwoosh.Pushwoosh
Pushwoosh.getInstance().startServerCommunication()
Register for push notifications
Section titled “Register for push notifications”After communication is enabled, explicitly register for push notifications:
import com.pushwoosh.Pushwoosh;
Pushwoosh.getInstance().registerForPushNotifications();
import com.pushwoosh.Pushwoosh
Pushwoosh.getInstance().registerForPushNotifications()
Disable communication
Section titled “Disable communication”To stop communication with Pushwoosh servers (e.g., if the user revokes consent):
import com.pushwoosh.Pushwoosh;
Pushwoosh.getInstance().stopServerCommunication();
import com.pushwoosh.Pushwoosh
Pushwoosh.getInstance().stopServerCommunication()
Disable SDK server communication at startup
Section titled “Disable SDK server communication at startup”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
.
Check communication status
Section titled “Check communication status”Use the following method to check whether server communication is currently allowed:
bool enabled = Pushwoosh.Instance.IsCommunicationEnabled();
Enable SDK communication after consent
Section titled “Enable SDK communication after consent”To enable communication after consent:
Pushwoosh.Instance.SetCommunicationEnabled(true);
Register for push notifications
Section titled “Register for push notifications”Once communication is enabled, you can register the device for push notifications:
Pushwoosh.Instance.RegisterForPushNotifications();
Disable communication
Section titled “Disable communication”To stop communication with Pushwoosh servers (e.g., if the user revokes consent):
Pushwoosh.Instance.SetCommunicationEnabled(false);