Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Fingerprint API for Android

Fingerprint API for Android

Takuji Nishibayashi

November 30, 2015
Tweet

More Decks by Takuji Nishibayashi

Other Decks in Technology

Transcript

  1. About me • Takuji Nishibayashi • @takuji31 • Fenrir Inc.

    • NNID: takuji31 • Udemae: S / Rank: 41 • Loves Android / Kotlin
  2. PIN

  3. Check keyguard is enabled public class MainActivity extends Activity {

    KeyguardManager mKeyguardManager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (!mKeyguardManager.isKeyguardSecure()) { // keyguard disabled Toast.makeText(this, "Secure lock screen hasn't set up.\n" + "Go to 'Settings -> Security -> Fingerprint' to set up a fingerprint", Toast.LENGTH_LONG).show(); return; } } }
  4. Check fingerprint registered public class MainActivity extends Activity { @Inject

    FingerprintManager mFingerprintManager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (!mFingerprintManager.hasEnrolledFingerprints()) { // no fingerprints registered Toast.makeText(this, "Go to 'Settings -> Security -> Fingerprint' and register at least one fingerprint", Toast.LENGTH_LONG).show(); return; } } }
  5. Start Authentication mCancellationSignal = new CancellationSignal(); mFingerprintManager.authenticate(cryptoObject, mCancellationSignal, 0, this,

    null); @Override public void onAuthenticationError(int errMsgId, CharSequence errString) { // authentication error } @Override public void onAuthenticationHelp(int helpMsgId, CharSequence helpString) { // needs help? } @Override public void onAuthenticationFailed() { // failed } @Override public void onAuthenticationSucceeded(FingerprintManager.AuthenticationResult result) { // succeeded }
  6. but

  7. No!

  8. !

  9. URL • Android 6.0 APIs • http://developer.android.com/intl/ja/about/versions/marshmallow/ android-6.0.html#fingerprint-authentication • Android

    Keystore System • http://developer.android.com/intl/ja/training/articles/keystore.html • FingerprintDialog sample • http://developer.android.com/intl/ja/samples/FingerprintDialog/ index.html • Google Store • https://store.google.com/category/phones • Buy now !