What is the difference between Flutter Android Embedding V1 and V2

前端 未结 2 1319
再見小時候
再見小時候 2021-02-20 17:05

I am working on a plugin for Flutter with background stuff.
Recently, I faced somethings about Flutter android embedding in the android_alarm_manager plugin

2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-20 17:52

    According to docs:

    In order to better support the execution environments of adding Flutter to an existing project, the old Android platform-side wrappers hosting the Flutter runtime at io.flutter.app.FlutterActivity and their associated classes are now deprecated. New wrappers at io.flutter.embedding.android.FlutterActivity and associated classes now replace them.

    Those classes better support real world scenarios where the FlutterActivity isn't the first and only Android Activity in an application.

    The embedded v2 provides better support for things like background execution (firebase messaging for instance. Checkout the changeLog).

    If you are developing a plugin, you should consider starting with embedded v2. Existing packages are already migrated or migrating.

提交回复
热议问题