User consent

User privacy is a central concern of Inloco. Regulations such as the General Data Protection Regulation (GDPR) require application developers to ask for permission before collecting user data. Inloco SDK provides a mechanism to handle this in a user friendly way.

💬Asking for the user consent

The Inloco SDK provides a way to delay data collection until the user has given privacy consent.

To wait for the user's privacy consent, you must set <bool name="inloco_privacy_consent_required">true</bool> on the inloco.xml file. By doing this, the SDK will be initialized without data collection. The default value for this option is false.

To check if a given set of consents has been explicitly set, the following method can be used. If the consents are missing, it is necessary to show the privacy policy to the user explaining why those consent types are needed and what benefits are available with the granted consents.

Kotlin
Java
Kotlin
InLoco.checkConsent(context, ConsentListener { response ->
if (response.isWaitingConsent) {
// The consent types tested are pending. You need to explicitly ask the user to allow or deny these types and forward the results to the Inloco SDK.
} else {
// The consent types tested have been explicitly allowed or denied by the user.
}
}, ConsentTypes.ALL)
Java
InLoco.checkConsent(this, new ConsentListener() {
@Override
public void onConsentResult(final ConsentResult result) {
if (result.isWaitingConsent()) {
// The consent types tested are pending. You need to explicitly ask the user to allow or deny these types and forward the results to the Inloco SDK.
} else {
// The consent types tested have been explicitly allowed or denied by the user.
}
}
}, ConsentTypes.ALL);

🧠Note: The InLoco.checkConsentcallback is called on the main thread.

After the user agrees to the privacy policy, one of the following methods must be called to allow or deny the SDK to begin collecting data:

Option 1:

Request privacy consent using Inloco's Consent Dialog

🧠Note: This is a consent dialog provided by Incognia but you can use your own consent dialog if you want.

Inloco's SDK provides a consent dialog that configures the consent correctly after the user interaction with the form.

You can customize the message attributes such as dialog title, message body, accept and deny button messages.

Kotlin
Java
Kotlin
class MainActivity : Activity() {
companion object {
private const val TAG = "MainActivity"
}
private var consentRequest: ConsentRequest? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
showConsentDialogUsingInLoco()
}
private fun showConsentDialogUsingInLoco() {
// Dialog Options
val consentDialogOptions = ConsentDialogOptions.Builder(this)
.acceptText(getString(R.string.consent_dialog_accept_button))
.denyText(getString(R.string.consent_dialog_deny_button))
.title(getString(R.string.consent_dialog_title))
.message(getString(R.string.consent_dialog_message))
.consentTypes(ConsentTypes.ALL) // Remember to specify consent types that make sense for your application
.build()
consentRequest = InLoco.requestPrivacyConsent(consentDialogOptions) { response ->
if (response.areAllConsentTypesGiven()) {
Log.i(TAG, "Success!")
}
}
}
override fun onDestroy() {
super.onDestroy()
consentRequest?.dismiss()
}
}
Java
public class MainActivity extends Activity {
private final static String TAG = "MainActivity";
private ConsentRequest consentRequest;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);;
showConsentDialogUsingInLoco();
}
private void showConsentDialogUsingInLoco() {
// Dialog Options
ConsentDialogOptions options = new ConsentDialogOptions.Builder(context)
.title(getString(R.string.consent_dialog_title))
.message(getString(R.string.consent_dialog_message))
.acceptText(getString(R.string.consent_dialog_accept_button))
.denyText(getString(R.string.consent_dialog_deny_button))
.consentTypes(ConsentTypes.ALL) // Remember to specify consent types that make sense for your application
.build();
this.consentRequest = InLoco.requestPrivacyConsent(options, new ConsentListener() {
@Override
public void onConsentResult(final ConsentResult result) {
if (result.areAllConsentTypesGiven()) {
Log.i(TAG, "Success!");
}
}
});
}
@Override
protected void onDestroy() {
super.onDestroy();
// Dismisses the dialog if the activity is abruptly closed
if (consentRequest != null) {
consentRequest.dismiss();
}
}
}

Option 2:

InLoco.setAllowedConsentTypes(Context context, Set consentTypes)

Sets consent types allowed by the user. All other predefined consent types not present in the consentTypes set are considered denied by the user. A call to this method replaces any other consent information previously set.

Kotlin
Java
Kotlin
import com.inlocomedia.android.common.ConsentTypes
// This call should be made in your code after the user has given privacy consent
InLoco.setAllowedConsentTypes(context,
new HashSet<>(Arrays.asList(
ConsentTypes.ENGAGE,
ConsentTypes.EVENTS,
ConsentTypes.INSTALLED_APPS,
ConsentTypes.LOCATION,
ConsentTypes.CONTEXT_PROVIDER)))
Java
import com.inlocomedia.android.common.ConsentTypes;
// This call should be made in your code after the user has given privacy consent
InLoco.givePrivacyConsent(context,
new HashSet<>(Arrays.asList(
ConsentTypes.ENGAGE,
ConsentTypes.EVENTS,
ConsentTypes.INSTALLED_APPS,
ConsentTypes.LOCATION,
ConsentTypes.CONTEXT_PROVIDER)));

Option 3:

InLoco.allowConsentTypes(Context context, Set consentTypes)

Allows consent for the functionality types specified in the consentTypes parameter. A call to this method does not modify other consent types not present in the consentTypes parameter.

Kotlin
Java
Kotlin
import com.inlocomedia.android.common.ConsentTypes
// This call should be made in your code after the user has given privacy consent
InLoco.allowConsentTypes(context,
new HashSet<>(Arrays.asList(
ConsentTypes.ENGAGE,
ConsentTypes.EVENTS,
ConsentTypes.INSTALLED_APPS,
ConsentTypes.LOCATION,
ConsentTypes.CONTEXT_PROVIDER)))
Java
import com.inlocomedia.android.common.ConsentTypes;
// This call should be made in your code after the user has given privacy consent
InLoco.allowConsentTypes(context,
new HashSet<>(Arrays.asList(
ConsentTypes.ENGAGE,
ConsentTypes.EVENTS,
ConsentTypes.INSTALLED_APPS,
ConsentTypes.LOCATION,
ConsentTypes.CONTEXT_PROVIDER)));

The user's consent preferences are persisted. It is not required to call the methods above multiple times (e.g., on every app startup). If the user allows at least one consent type, the following SDK initializations will start with data collection enabled.

🧩 Consent types

Name

Description

Plan

LOCATION

Enables the collection of location data from users.

Free

ENGAGE

Enables the usage of location data to send push notifications.

Free, Pro

EVENTS

Enables the usage of data in customized events.

Enterprise

CONTEXT_PROVIDER

Enables the context data delivery for engagement actions or analysis.

Enterprise

COVID_19_AID

Enables COVID-19 aid.

Custom

If you wish to use all or none of them, you can use one of the following variables:

Name

Description

ALL

Enable all consent types (except COVID_19_AID).

NONE

Disable all consent types.

🧠Note: It is important to notice that without data collection, features won't be enabled for the user. For example, it won't be possible to send localized push notifications without location data.

🚧Attention: The default value of inloco_privacy_consent_required is false. It means that not setting this property will make the SDK start data collection right away and you need to ask the user consent through your app's Privacy Policy. In following SDK versions, this setting will be removed and consent will be always required.

It is also possible for the user to revoke consent types previously allowed. When this happens, you should call InLoco.denyConsentTypes(Context context, Set consentTypes) specifying the consent types to be denied.

Kotlin
Java
Kotlin
import com.inlocomedia.android.common.ConsentTypes
InLoco.denyConsentTypes(context,
new HashSet<>(Arrays.asList(
ConsentTypes.ENGAGE,
ConsentTypes.EVENTS,
ConsentTypes.INSTALLED_APPS,
ConsentTypes.LOCATION,
ConsentTypes.CONTEXT_PROVIDER)))
Java
import com.inlocomedia.android.common.ConsentTypes;
InLoco.denyConsentTypes(context,
new HashSet<>(Arrays.asList(
ConsentTypes.ENGAGE,
ConsentTypes.EVENTS,
ConsentTypes.INSTALLED_APPS,
ConsentTypes.LOCATION,
ConsentTypes.CONTEXT_PROVIDER)));

A call to this method denies consent for the functionality types specified in the consentTypes parameter. It does not modify other consent types not present in the consentTypes parameter.