Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FlutterActivity vs FlutterFragmentActivity

I was trying to implement local_auth package into my Flutter app.

in the documentation, it was mentioned that it will have to use FlutterFragmentActivity instead of FlutterActivity in my MainActivity class.

So I wanted to know what are the main differences between FlutterFragmentActivity and FlutterActivity and how both impact app's performance?

:) as I don't want to make a change and break the app in production.

like image 269
atulvinod1911 Avatar asked Apr 28 '26 23:04

atulvinod1911


2 Answers

A FragmentActivity is a subclass of Activity that was built for the Android Support Package.

The FragmentActivity class adds a couple of new methods to ensure compatibility with older versions of Android, but other than that, there really isn't much of a difference between the two.

https://developer.android.com/topic/libraries/support-library

Info from this thread https://stackoverflow.com/a/10478048/7198006

So, it doesn't impact performance.

like image 54
awaik Avatar answered Apr 30 '26 12:04

awaik


In my apps, I see those activities act differently when you press back button (or perform back gesture) at the root screen of your app:

FlutterActivity: Your app will be closed.

FlutterFragmentActivity : Your app will be move to background.

like image 40
Phong_NguyenGia Avatar answered Apr 30 '26 12:04

Phong_NguyenGia



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!