If your app will have European Union users, it should comply with the General Data Protection Regulation (GDPR). This means you need to ask for user’s consent before collecting their private data.

The HyBid SDK is GDPR compliant, however a few steps are necessary to collect the user’s consent and therefore provide a more personalised ad experience therefore higher payouts.

Initialization

Upon initialization, the SDK follows this flow:

  1. Initialize the SDK using the app token
  2. Check the location from where the user is connection using the IP address and an external service (ip-api.com).
  3. If the country the app is connecting from is inside the GDPR jurisdiction zone, then set a flag that defines that the SDK needs user consent before keeping the data.
  4. Execute initialization callback to notify that initialization happened successfully.

To initialize the SDK the following code should be used ideally on the Application class onCreate method:

HyBid.initialize(settings.getAppToken(), this, new HyBid.InitialisationListener() {
    @Override
    public void onInitialisationFinished(boolean success) {
        // HyBid SDK has been initialised
    }
});

After the initialization finishes, if at some point you need to know if the app needs to ask for the user’s consent, you can use the following function:

boolean shouldAsk = HyBid.getUserDataManager().shouldAskConsent();

Request user consent

There are two ways to request the consent from the user to process their personal data. Both of them are explained in the following sections.

PubNative Owned Consent

This way to request displays a screen included in the HyBid SDK which shows PubNative’s consent page and allows users to opt-in or opt-out.

Once the screen is showed and the user interacts with it, the SDK itself handles the responses of the user and notifies the PubNative server if the user opted in or out regarding the processing of their data.

To display the consent screen you can use the following code:

if (HyBid.getUserDataManager().shouldAskConsent()) {
    Intent intent = HyBid.getUserDataManager().getConsentScreenIntent(activity);
    startActivity(intent);
}

If you want to get a notification regarding the choice of the user, you can user startActivityForResult to get the information.

if (HyBid.getUserDataManager().shouldAskConsent()) {
    Intent intent = HyBid.getUserDataManager().getConsentScreenIntent(activity);
    startActivityForResult(intent, REQUEST_CONSENT);
}

REQUEST_CODE can be any integer you choose to later determine if the Activity result is coming from the consent screen.

To obtain the result from the user’s choice use this lines on the onActivityResult callback:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == REQUEST_CONSENT) {
        if (resultCode == UserConsentActivity.RESULT_CONSENT_ACCEPTED) {
            //User has opted-in
        } else if (resultCode == UserConsentActivity.RESULT_CONSENT_REJECTED) {
            //User has opted-out
        }
    }
}

Publisher owned consent

If you implement your own mechanism to collect consent in your app, then you need to user PubNative’s vendor list and privacy policy to obtain consent on their behalf.

You can obtain the URL to those pages using the following functions:

String vendorList = HyBid.getUserDataManager().getVendorListLink();

String privacyPolicy = HyBid.getUserDataManager().getPrivacyPolicyLink();

If the user chooses to opt-in for the processing of their data, then you should call the following function to notify HyBid SDK of their choice:

HyBid.getUserDataManager().grantConsent();

This will cache their choice and notify the PubNative platform about it.

Otherwise if the user chooses to opt-out then the you should use the following function:

HyBid.getUserDataManager().denyConsent();

Check if data can be collected

The method canCollectData from UserDataManager can be used to determine if the SDK can collect user data. It will return true if the user is outside the European Union or if he gave consent for data collection previously, otherwise if will return false.

boolean canCollectData = HyBid.getUserDataManager().canCollectData();

NOTE:

Keep in mind that for the two mechanisms (PubNative Owned & Publisher Owned consents), the user consent is based on their Advertising ID. If the user chooses to reset their Google Advertising ID on their phone, then the HyBid SDK will consider it as a new data subject and will need to require consent again.