From 184dc9d6d08a25f2712be86256a9e14604c517f5 Mon Sep 17 00:00:00 2001 From: Taha Tesser Date: Wed, 7 Oct 2020 17:10:15 +0530 Subject: [PATCH 1/2] update local_auth readme --- packages/local_auth/CHANGELOG.md | 6 +++++- packages/local_auth/README.md | 36 +++++++++++++++++++++++++++++++- packages/local_auth/pubspec.yaml | 2 +- 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/packages/local_auth/CHANGELOG.md b/packages/local_auth/CHANGELOG.md index a1dc7aaa4e16..916aa8bd544a 100644 --- a/packages/local_auth/CHANGELOG.md +++ b/packages/local_auth/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.6.3+3 + +* Update README for Android Integration. + ## 0.6.3+2 * Keep handling deprecated Android v1 classes for backward compatibility. @@ -166,4 +170,4 @@ ## 0.0.1 -* Initial release of local authentication plugin. +* Initial release of local authentication plugin. \ No newline at end of file diff --git a/packages/local_auth/README.md b/packages/local_auth/README.md index ca2aa49bed23..7267de1e6271 100644 --- a/packages/local_auth/README.md +++ b/packages/local_auth/README.md @@ -142,6 +142,40 @@ 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: @@ -172,4 +206,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). \ No newline at end of file diff --git a/packages/local_auth/pubspec.yaml b/packages/local_auth/pubspec.yaml index db34a461e0d8..9505c774e24d 100644 --- a/packages/local_auth/pubspec.yaml +++ b/packages/local_auth/pubspec.yaml @@ -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: 0.6.3+2 +version: 0.6.3+3 flutter: plugin: From 4bc4a83e5ca600a33d3f4710f8fd1b6c22242a1d Mon Sep 17 00:00:00 2001 From: David Iglesias Teixeira Date: Thu, 17 Dec 2020 16:46:14 -0800 Subject: [PATCH 2/2] Address PR #3121 comments. --- packages/local_auth/README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/local_auth/README.md b/packages/local_auth/README.md index 7267de1e6271..98dcdcf0bffa 100644 --- a/packages/local_auth/README.md +++ b/packages/local_auth/README.md @@ -142,7 +142,8 @@ 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 +Update your MainActivity.java: + ```java import android.os.Bundle; import io.flutter.app.FlutterFragmentActivity; @@ -163,7 +164,8 @@ public class MainActivity extends FlutterFragmentActivity { OR -Update your MainActivity.kt +Update your MainActivity.kt: + ```kotlin import io.flutter.embedding.android.FlutterFragmentActivity import io.flutter.embedding.engine.FlutterEngine