Skip to content

Commit

Permalink
[local_auth] Update README for Android Integration (flutter#3348)
Browse files Browse the repository at this point in the history
  • Loading branch information
ditman authored Dec 18, 2020
1 parent b6af039 commit b1ab21a
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 3 deletions.
6 changes: 5 additions & 1 deletion packages/local_auth/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.0.0-nullsafety.1

* Update README for Android Integration.

## 1.0.0-nullsafety

* Migrate to null safety.
Expand Down Expand Up @@ -182,4 +186,4 @@

## 0.0.1

* Initial release of local authentication plugin.
* Initial release of local authentication plugin.
38 changes: 37 additions & 1 deletion packages/local_auth/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,42 @@ opposed to Activity. This can be easily done by switching to use
`FlutterFragmentActivity` as opposed to `FlutterActivity` in your
manifest (or your own Activity class if you are extending the base class).

Update your MainActivity.java:

```java
import android.os.Bundle;
import io.flutter.app.FlutterFragmentActivity;
import io.flutter.plugins.flutter_plugin_android_lifecycle.FlutterAndroidLifecyclePlugin;
import io.flutter.plugins.localauth.LocalAuthPlugin;

public class MainActivity extends FlutterFragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FlutterAndroidLifecyclePlugin.registerWith(
registrarFor(
"io.flutter.plugins.flutter_plugin_android_lifecycle.FlutterAndroidLifecyclePlugin"));
LocalAuthPlugin.registerWith(registrarFor("io.flutter.plugins.localauth.LocalAuthPlugin"));
}
}
```

OR

Update your MainActivity.kt:

```kotlin
import io.flutter.embedding.android.FlutterFragmentActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugins.GeneratedPluginRegistrant

class MainActivity: FlutterFragmentActivity() {
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine)
}
}
```

Update your project's `AndroidManifest.xml` file to include the
`USE_FINGERPRINT` permissions:

Expand Down Expand Up @@ -172,4 +208,4 @@ app resumes.
For help getting started with Flutter, view our online
[documentation](http://flutter.io/).

For help on editing plugin code, view the [documentation](https://flutter.io/platform-plugins/#edit-code).
For help on editing plugin code, view the [documentation](https://flutter.io/platform-plugins/#edit-code).
2 changes: 1 addition & 1 deletion packages/local_auth/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: local_auth
description: Flutter plugin for Android and iOS device authentication sensors
such as Fingerprint Reader and Touch ID.
homepage: https://github.com/flutter/plugins/tree/master/packages/local_auth
version: 1.0.0-nullsafety
version: 1.0.0-nullsafety.1

flutter:
plugin:
Expand Down

0 comments on commit b1ab21a

Please sign in to comment.