DEV Community

Cover image for Accessing User GDPR Settings in AIR
Michael
Michael

Posted on

4 3

Accessing User GDPR Settings in AIR

At some point in your application development when you start to store and share data you will need to handle user GDPR settings.

The General Data Protection Regulation (GDPR) is a European Union (EU) regulation that mandates how an organisation should handle personal data.

If you use personalised advertising or store user related data on your server then you will need to address GDPR concerns in your application.

On mobile devices the GDPR settings are stored through the IAB Europe Transparency & Consent Framework. This framework ensures settings are stored in consistent places for developers to access and determine their appropriate behaviour for the user.

These values are stored in NSUserDefaults on iOS and in SharedPreferences on Android.

With the AIR SDK we can access these values easily through the Application extension. The Application extension allows access to the NSUserDefaults and the SharedPreferences through the defaults functionality.

Firstly, we set the useSharedDefaults flag to ensure we use the application's shared values.

Application.service.defaults.useSharedDefaults = true;
Enter fullscreen mode Exit fullscreen mode

If we don't set this flag, then the values retrieved through the defaults functionality will be isolated from values set via other methods and you won't retrieve the correct TC data values.

Once you have set this flag you can retrieve any of the TC data from the framework by using the appropriate key.

For example:

var value:String = 
    Application.service.defaults.
        getString( "IABTCF_TCString" );
Enter fullscreen mode Exit fullscreen mode

You can then use this value as required for your implementation of GDPR in your application.

For a full list of the available keys and a description of the values and types see the documentation here.

Image of Datadog

Master Mobile Monitoring for iOS Apps

Monitor your app’s health with real-time insights into crash-free rates, start times, and more. Optimize performance and prevent user churn by addressing critical issues like app hangs, and ANRs. Learn how to keep your iOS app running smoothly across all devices by downloading this eBook.

Get The eBook

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more