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.

Do your career a big favor. Join DEV. (The website you're on right now)

It takes one minute, it's free, and is worth it for your career.

Get started

Community matters

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay