Skip to content

Commit 483c816

Browse files
Update migration_to_v2.md
1 parent 27d10ff commit 483c816

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

docs/migration_to_v2.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
## Changes in major version 2
22

33
### 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.
66

77
In the major version 2, the version is passed to `getDeviceId(..)` and `getFingerprint(..)` methods.
88

99
### 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:
1111
1. Call `Fingerprinter.getFingerprint(stabilityLevel, listener)` to retrieve `FingerprintResult`
1212
2. Call `FingerprintResult.getSignalProvider` to retrieve a signal provider a signal belongs to, e.g., `HardwareSignalGroupProvider`
1313
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:
1717
1. Call `Fingerprinter.getFingerprintingSignalsProvider()`
1818
2. Call `fingerprintingSignalsProvider.manufacturerNameSignal`
1919

20-
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.
2121
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.
2222

2323
### 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)
2525

2626
### 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.
2930

3031
### Caveats
3132
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

Comments
 (0)