Usage of DeviceFingerprintGenerator

DeviceFingerprintGenerator generates a unique fingerprint calculated from device-specific data, such as carrier, operating system version, and similar data.

Activation Spawn is using this generator to safely transfer the activation data between applications.

It’s crutial that the Source App and Target App are using the same configuration of the generator.

Configure generator

The DeviceFingerprintGenerator class supports various levels of stability for the generated fingerprint:

  • Stable generator can generate a fingerprint that doesn’t change for a long time (like days, or up to the next device boot). The fingerprint is generated from sources with low entropy, so if you plan to generate a cryptographic key, then it will be weak.

  • Semi stable generator can generate a fingerprint that can last for minutes. The fingerprint is generated from sources with higher entropy than stable generator.

  • Unstable generator can generate an unstable fingerprint that can change anytime. It’s because the user can easily affect the fingerprint by a simple action (like putting the device on a charger). It’s recommended to use such fingerprint for a very short time, like for seconds. The fingerprint is generated from sources with the highest entropy.

  • Time-based generator can generate a fingerprint that changes over time. You can combine a time-based generator with all the above generator stability classes.

You can use the following static functions to construct such generators:

val stableGenerator = DeviceFingerprintGenerator.getStable(context)
val semiStableGenerator = DeviceFingerprintGenerator.getSemiStable(context)
val unstableGenerator = DeviceFingerprintGenerator.getUnstable(context)

Each static function has the following set of optional parameters:

  • useAndroidId: Boolean: If true then ANDROID_ID identifier will be used as a source to fingerprint generator. The default value is true.
  • timeSpan: Long?: If set, then the fingerprint will be valid for a given amount of seconds. The default value is null.
  • additionalData: ByteArray?: If set, then the provided data will be added as a source to the fingerprint generator. The default value is null.

For example, you can use the following code to generate a semi-stable generator that will generate a new fingerprint every 5 seconds, valid for all applications installed on the device:

val generator = DeviceFingerprintGenerator.getSemiStable(context, false, 5)
Last updated on Sep 07, 2023 (13:01) Edit on Github Send Feedback
Search

1.5.0

Activation Spawn SDK for Android