I am trying to configure local_auth in my flutter app and I came across following instructions local_auth plugin Android Integration.
local_auth plugin requires the use of a FragmentActivity instead of Activity. This can be easily done by switching FlutterFragmentActivity to FlutterActivity in the manifest (or your own Activity class if you are extending the base class).
Following is my MainActivity class code snippets:
package com.example.xxxxxxxx;
import android.os.Bundle;
import io.flutter.app.FlutterActivity;
import io.flutter.plugins.GeneratedPluginRegistrant;
import com.anggach.flutterandroidlifecycle.FlutterAndroidLifecycleActivity;
import io.flutter.app.FlutterFragmentActivity;
public class MainActivity extends FlutterAndroidLifecycleActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
GeneratedPluginRegistrant.registerWith(this);
}
}
But my problem is that MainActivity class in my code is already extending from FlutterAndroidLifecycleActivity, and I am not able to extend it from two packages.
Some additional details: I tried to resolve it by putting both the classes together but didn't get success because Java doesn't support Multiple Inheritance.
There are other resources about this in Java as:
Can one class extend two classes?
To summarise the issue, I need to be able to extend both FlutterFragmentActivity
and FlutterAndroidLifecycleActivity
from MainActivity