Android
Incognia SDK v6 brings a complete reorganization of classes and dependencies that best reflect the products and use cases offered by the company. A brief description of the interfaces is as follows.
Class | Description |
---|---|
Incognia | Contains the initialization, accountId, installationId and privacy related methods. |
Update your dependencies
Change the version of com.incognia:incognia
to 6.6.4
and update the Google Play Services dependencies in your app-level build.gradle
file:
dependencies {
//UPDATE TO 6.6.4
implementation 'com.incognia:incognia:6.6.4'
//UPDATE GOOGLE PLAY SERVICES TO 17.+
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0'
}
Changes in Incognia class
The Incognia
was moved from the package com.incognia.icg
to com.incognia
. Make sure to replace all imports with the new package.
Changes in sdk initialization/options methods
Initialization methods now require a instance of Application
instead of Context
. The table below shows equivalent method signatures in v5 and v6:
v5 | v6 |
---|---|
Incognia.init(Context context) | Incognia.init(Application application) |
Incognia.init(Context context, IncogniaOptions incogniaOptions) | Incognia.init(Application application, IncogniaOptions incogniaOptions) |
Incognia.disable(Context context) | Incognia.disable(Context context) |
Incognia.setVisitsTrackingEnabled(Context context, boolean enabled) | Incognia.setLocationEnabled(final boolean enabled) |
For more details, please check the Initializing the SDK section.
Changes in userId methods
UserId methods were renamed and simplified. Passing a Context
instance is no longer required. The table below shows equivalent method signatures in v5 and v6:
v5 | v6 |
---|---|
Incognia.setUserId(Context context, String userId) | Incognia.setAccountId(String accountId) |
Incognia.clearUserId(Context context) | Incognia.clearAccountId() |
For more details, please check the Account ID section.
Changes in address methods
This feature is also available via API, which is now the recommended way of using it. Legacy support is still available at the present moment. These methods were renamed and simplified. Passing a Context
instance is no longer required. The table below shows equivalent method signatures in v5 and v6:
v5 | v6 |
---|---|
Incognia.setAddress(Context context, Address address) | Incognia.setAddress(Address address) - Deprecated. Prefer setting this through the Incognia API |
Incognia.clearAddress(Context context) | Incognia.clearAddress() - Deprecated. Prefer setting this through the Incognia API |
Changes in events methods
Events methods were simplified and a Context
instance is no longer required. CheckIn methods were removed as this feature is no longer available. The table below shows equivalent method signatures in v5 and v6:
v5 | v6 |
---|---|
Incognia.registerCheckIn(Context context, CheckIn checkIn) | Removed. This feature is no longer supported. |
Incognia.trackEvent(Context context, String eventName) | Incognia.trackEvent(String eventName) |
Incognia.trackEvent(Context context, String eventName, Map<String, String> properties) | Incognia.trackEvent(String eventName, EventProperties properties) |
Incognia.trackLocalizedEvent(Context context, String eventName) | Incognia.trackLocalizedEvent(String eventName) |
Incognia.trackLocalizedEvent(Context context, String eventName, Map<String, String> properties) | Incognia.trackLocalizedEvent(String eventName, EventProperties properties) |
Changes in obtaining the installation ID
The installationId can now be obtained either synchronously or asynchronously. Select the method the best suit your needs.
v5 | v6 |
---|---|
Incognia.getInstallationId(Context context, IncogniaListener<String> listener) | Incognia.getInstallationId() Incognia.fetchInstallationId(IncogniaListener<String> listener) |
For more details, please check the Obtaining the Installation ID section.