DEV Community

Cover image for Accessing User GDPR Settings in AIR

Posted on

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 = 
        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.

Top comments (0)