All Projects → fingerprintjs → Fingerprint Android

fingerprintjs / Fingerprint Android

Licence: mit
Swiss army knife for identifying and fingerprinting Android devices.

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Fingerprint Android

fingerprintjs-android
Swiss army knife for identifying and fingerprinting Android devices.
Stars: ✭ 336 (+130.14%)
Mutual labels:  android-development, android-security
Best Android Tutorials
Best Free Android Tutorials By MindOrks
Stars: ✭ 144 (-1.37%)
Mutual labels:  android-development
Placepicker
Free Android Map Place Picker alternative using Geocoder instead of Google APIs
Stars: ✭ 126 (-13.7%)
Mutual labels:  android-development
Ibackdrop
A library to simply use Backdrop in your project (make it easy). Read more ->
Stars: ✭ 137 (-6.16%)
Mutual labels:  android-development
Atfuzzer
"Opening Pandora's Box through ATFuzzer: Dynamic Analysis of AT Interface for Android Smartphones" ACSAC 2019
Stars: ✭ 128 (-12.33%)
Mutual labels:  android-security
Textwriter
Animate your texts like never before
Stars: ✭ 140 (-4.11%)
Mutual labels:  android-development
Awesome Mobile Security
An effort to build a single place for all useful android and iOS security related stuff. All references and tools belong to their respective owners. I'm just maintaining it.
Stars: ✭ 1,837 (+1158.22%)
Mutual labels:  android-security
Simple Gallery
Browse your memories without any interruptions with this photo and video gallery
Stars: ✭ 2,128 (+1357.53%)
Mutual labels:  android-development
Ultimate Java Resources
Java programming. All in one Java Resource for learning. Updated every day and up to date. All Algorithms and DS along with Development in Java. Beginner to Advanced. Join the Discord link.
Stars: ✭ 143 (-2.05%)
Mutual labels:  android-development
Android Cards
CardView with Material Design using ConstraintLayout
Stars: ✭ 136 (-6.85%)
Mutual labels:  android-development
Uber Car Animation Android
An example project to demonstrate how to Add Uber Like Car Animation in Android App
Stars: ✭ 134 (-8.22%)
Mutual labels:  android-development
Chucker
🔎 An HTTP inspector for Android & OkHTTP (like Charles but on device)
Stars: ✭ 2,169 (+1385.62%)
Mutual labels:  android-development
Avoid Memory Leak Android
🔥 Examples of memory leaks and common patterns that cause them in Android development and how to fix/avoid them
Stars: ✭ 140 (-4.11%)
Mutual labels:  android-development
Backdoor Apk
backdoor-apk is a shell script that simplifies the process of adding a backdoor to any Android APK file. Users of this shell script should have working knowledge of Linux, Bash, Metasploit, Apktool, the Android SDK, smali, etc. This shell script is provided as-is without warranty of any kind and is intended for educational purposes only.
Stars: ✭ 1,766 (+1109.59%)
Mutual labels:  android-development
Groupchatapp
Developed a Group chat application using Flutter and Firebase, where users can register and create groups or join already existing groups and start conversing with each other.
Stars: ✭ 145 (-0.68%)
Mutual labels:  android-development
Petshop
Pet Shop is an e-commerce application for Android built with Flutter (iOS to come soon).
Stars: ✭ 127 (-13.01%)
Mutual labels:  android-development
Dagger Androidinjector
This sample is part of a tutorial on how to use the new dagger-android module, which was released in Dagger 2.10.
Stars: ✭ 134 (-8.22%)
Mutual labels:  android-development
Simple Dialer
A handy phone call manager with phonebook, number blocking and multi-SIM support
Stars: ✭ 138 (-5.48%)
Mutual labels:  android-development
Materialdrawer
The flexible, easy to use, all in one drawer library for your Android project. Now brand new with material 2 design.
Stars: ✭ 11,498 (+7775.34%)
Mutual labels:  android-development
Android Snapshot Publisher
Gradle plugin to deploy Android Snapshot Versions
Stars: ✭ 145 (-0.68%)
Mutual labels:  android-development

FingerprintJS

Latest release Build status Android minAPI status

PlaygroundApp

fingerprint android

Lightweight library for device identification and fingerprinting.

Fully written in Kotlin. 100% Crash-free.

Creates a device identifier from all available platform signals.

The identifier is fully stateless and will remain the same after reinstalling or clearing application data.

Table of Contents

  1. Quick start
  2. Usage
  3. Advanced usage
  4. Playground App

Quick start

Add repository

Add these lines to your build.gradle.

allprojects {	
  repositories {
  ...
  maven { url 'https://jitpack.io' }	
}}

Add dependency

Add these lines to build.gradle of a module.

This library depends on kotlin-stdlib.

If your application is written in Java, add kotlin-stdlib dependency first (it's lightweight and has excellent backward and forward compatibility).

dependencies {
  // Add this line only if you use this library with Java
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

  implementation "com.github.fingerprintjs:fingerprint-android:1.1"
}


deviceId vs fingerprint

The library operates with two entities.

  1. deviceId - is a random and unique device identifier.

Can be used by developers to identify devices to deliver personalized content, detect suspicious activity, and perform fraud detection. Internally it will use Google Service Framework ID if it's available and ANDROID_ID, if GSF ID is not available. This identifier is stable, i.e. it will remain the same even after reinstalling your app. But it will be different after factory reset of the device.

  1. fingerprint is a digital device fingerprint. It works by combining all available device signals and attributes into a single identifier. There is a probability that two identical devices will have the same fingerprint.

Which one should I use?

deviceId is guaranteed to be random and should be your first choice for device identification. This identifier can be spoofed though and shouldn't be used in security-focused or fraud detection scenarios.

fingerprint is much harder to spoof and is a safer choice in security-focused use cases.

Usage

Kotlin

// Initialization
 val fingerprinter = FingerprinterFactory
		.getInstance(applicationContext, Configuration(version = 1))


// Usage
fingerprinter.getFingerprint { fingerprintResult ->
  val fingerprint = fingerprintResult.fingerprint
}

fingerprinter.getDeviceId { result ->
  val deviceId = result.deviceId
}


Java

// Initialization
Fingerprinter fingerprinter = FingerprinterFactory
				.getInstance(getApplicationContext(), new Configuration(1));


// Usage
fingerprinter.getFingerprint(new Function1<FingerprintResult, Unit>() {
        @Override
        public Unit invoke(FingerprintResult fingerprintResult) {
        	String fingerprint = fingerprintResult.getFingerprint();
        	    return null;
            }
        });
        
fingerprinter.getDeviceId(new Function1<DeviceIdResult, Unit>() {
            @Override
            public Unit invoke(DeviceIdResult deviceIdResult) {
            	String deviceId = deviceIdResult.getDeviceId();
                return null;
            }
        });

getFingerprint and getDeviceId methods execute on a separate thread. Keep this in mind when using results on the main thread.

Also the results are cached, so subsequent calls will be faster.

Versioning

fingerprint is versioned incrementatlly; the version should be set explicitly to avoid unexpected fingerprint changes when updating the library.

The version is set while the initialization of the library with Configuration class.

val fingerprinter = FingerprinterFactory
		.getInstance(applicationContext, Configuration(version = 1))

Advanced usage

Reference for Kotlin is provided below. Java reference.

The full public API of the library is following:

interface Fingerprinter {
  fun getDeviceId(listener: (DeviceIdResult) -> (Unit))
  fun getFingerprint(listener: (FingerprintResult) -> (Unit))
  fun getFingerprint(stabilityLevel: StabilityLevel, listener: (FingerprintResult) -> (Unit))
}

interface FingerprintResult {
  val fingerprint: String
  fun <T> getSignalProvider(clazz: Class<T>): T?
}

data class DeviceIdResult(
  val deviceId: String,
  val gsfId: String?,
  val androidId: String
)

If you are using RxJava or Kotlin Coroutines - use the extensions.

Increasing the uniqueness of fingerprints

There is a probability that two different devices will have the same fingerprint value. There is also a probability that the same device will have different fingerprint values in different moments of time due to system upgrades or updated settings (although this should be infrequent).

By default the library calculates a fingerprint with optimal stability and uniqueness. But also there are two more modes for fingerprints: Stable and Unique.

Use them as shown below:

fingerprinter.getFingerprint(StabilityMode.STABLE) { fingerprintResult ->
  val stableFingerprint = fingerprintResult.fingerprint
}

fingerprinter.getFingerprint(StabilityMode.OPTIMAL) { fingerprintResult ->
  val optimalFingerprint = fingerprintResult.fingerprint
}

fingerprinter.getFingerprint(StabilityMode.UNIQUE) { fingerprintResult ->
  val uniqueFingerprint = fingerprintResult.fingerprint
}

Raw data access

If you need access to raw data from signal providers, you can get it as shown below:

fingerprinter.getFingerprint { fingerprintResult ->

  val hardwareSignalProvider = fingerprintResult
  			.getSignalProvider(HardwareSignalGroupProvider::class.java)

  val hardwareFingerprint = hardwareSignalProvider.fingerprint()

  val cpuInfo = hardwareSignalProvider.rawData().procCpuInfo()
}

Change hash function

The library uses Murmur3 hash (64x128) which is fast and optimal for most cases.

If this hash function does not work for you, you can change it to a different one.

To do it, implement your own hasher, and pass it to Configuration class as shown below:

val hasher = object : Hasher {
  override fun hash(data: String): String {
    // Implement your own hashing logic, e.g. call SHA256 here
  }
}

val fingerprinter = FingerprinterFactory.getInstance(
  applicationContext,
  Configuration(version = 1, hasher = hasher)

)

Backward compatibility

If you want to get a newer version of fingerprint, but also want to keep the old one for backward compatibility, you can get them both as shown below:

val v1Fingerprinter = FingerprinterFactory
		.getInstance(applicationContext, Configuration(version = 1))

val v2Fingerprinter = FingerprinterFactory
		.getInstance(applicationContext, Configuration(version = 2))


v1Fingerprinter.getFingerprint { fingerprintResult ->
  val v1Fingerprint = fingerprintResult.fingerprint
}

v2Fingerprinter.getFingerprint { fingerprintResult ->
  val v2Fingerprint = fingerprintResult.fingerprint
}

Playground App

Try all the library features in the Playground App.

PlaygroundApp

Android API support

fingerprint-android supports API versions from 16 (Android 4.1) and higher.

Contributing

Feel free to ask questions and request features. Just create an issue with a clear explanation of what you'd like to have in the library. For code contributions, please see the contributing guideline.

License

This library is MIT licensed. Copyright FingerprintJS, Inc. 2020-2021.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].