You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/migration_to_v2.md
+8-7Lines changed: 8 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,13 @@
1
1
## Changes in major version 2
2
2
3
3
### Ditching global `Configuration` class
4
-
In the major version 1 of the library, the configuration was passed to the factory method `FingerprinterFactory.getInstance(context, configuration)`.
5
-
This meant that if you wanted to get multiple fingerprints of different versions, say, in order to migrate to the newer version of fingerprint, you had to call `getInstance` method twice, which is both ineffective and inconvenient.
4
+
In the major version 1.* of the library, the configuration was passed to the factory method `FingerprinterFactory.getInstance(context, configuration)`.
5
+
Then if you wanted to get multiple fingerprints of different versions (e.g. in order to migrate to the newer version of fingerprints) you had to call `getInstance` method twice making it both ineffective and inconvenient.
6
6
7
7
In the major version 2, the version is passed to `getDeviceId(..)` and `getFingerprint(..)` methods.
8
8
9
9
### Ditching `SignalGroupProvider` class
10
-
In the major version 1 of the library, if you wanted to retrieve any particular signal involved in fingerprinting, you had to do the following:
10
+
In the major version 1.* of the library, if you wanted to retrieve any particular signal involved in fingerprinting, you had to do the following:
11
11
1. Call `Fingerprinter.getFingerprint(stabilityLevel, listener)` to retrieve `FingerprintResult`
12
12
2. Call `FingerprintResult.getSignalProvider` to retrieve a signal provider a signal belongs to, e.g., `HardwareSignalGroupProvider`
13
13
3. Get `RawData` from that particular signal provider, e.g., `HardwareFingerprintRawData`
@@ -17,15 +17,16 @@ To do the same thing in major version 2, you have to do the following:
This approach requires less code and does not involve unnecessary fingerprint calculation.
20
+
This approach requires less code and does not involve unnecessary fingerprints calculation.
21
21
Also, it allows to reduce the complexity of the code base by making signal's hierarchy *flat*, i.e. not dividing signals into different signal groups based on their nature.
22
22
23
23
### Introducing API for custom fingerprinting
24
-
The new method `Fingerprinter.getFingerprint(fingerprintingSignals, hasher)` allows you to create fingerprints based on whatever signals you want. In order to get signals first, use `FingerprintingSignalsProvider` class.
24
+
The new method `Fingerprinter.getFingerprint(fingerprintingSignals, hasher)` allows you to create fingerprints based on whatever signals you want. In order to get signals first, use `FingerprintingSignalsProvider` class. See the example in the [Full API reference](api_reference.md)
25
25
26
26
### Changing behaviour of the factory method
27
-
Not only we have removed `configuration` parameter from the factory method, but also changed it's behaviour. This is why now we have `FingerprinterFactory.create(context)` method instead of `FingerprinterFactory.getInstance(context, configuration)` method.
28
-
Whereas the latter method always returned the same instance given the same `configuration`, the former always returns a new instance of `Fingerprinter`. This may be useful if you want to calculate the fingerprint from scratch multiple times. This cannot be possible with a reinstantiation of `Fingerprinter`, because fingerprinting signals inside it are cached internally.
27
+
We have removed `configuration` parameter from the factory method and changed it's behaviour. This is why now we have `FingerprinterFactory.create(context)` method instead of `FingerprinterFactory.getInstance(context, configuration)` method.
28
+
29
+
Whereas the latter method always returned the same instance given the same `configuration`, the former always returns a new instance of `Fingerprinter`. This may be useful if you want to calculate the fingerprint from scratch multiple times.
29
30
30
31
### Caveats
31
32
Even though all the changes listed above are aimed towards making the API both more flexible and more convenient at the same time, there is one scenario of the API v1 usage that cannot be easily migrated to API v2.
0 commit comments