-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Open
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projecte: embedderUsers of the Embedder APIUsers of the Embedder APIp: flutter_plugin_android_lifecycleThe flutter_plugin_android_lifecycle pluginThe flutter_plugin_android_lifecycle pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyAndroid applications specificallyteam-androidOwned by Android platform teamOwned by Android platform teamtriaged-androidTriaged by Android platform teamTriaged by Android platform team
Description
Currently the plugin only exposes a getter for the activity lifecycle, a getter for the lifecycle available through ServicePluginBinding should be added as well.
The code should be just:
@Nullable
public static Lifecycle getServiceLifecycle(@NonNull ServicePluginBinding servicePluginBinding) {
try {
Method getLifecycle = ServicePluginBinding.class.getMethod("getLifecycle");
Object hiddenLifecycle = getLifecycle.invoke(activityPluginBinding);
return getHiddenLifecycle(hiddenLifecycle);
} catch (ClassNotFoundException
| NoSuchMethodException
| IllegalAccessException
| InvocationTargetException e) {
Log.w(
TAG,
"You are attempting to use Flutter plugins that are newer than your"
+ " version of Flutter. Plugins may not work as expected.");
}
return null;
}The part that requires some more work is getting the integration test to launch a service and exercise this code path.
I'm starting with landing just an activity lifecycle getter to fix red CI.
Metadata
Metadata
Assignees
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projecte: embedderUsers of the Embedder APIUsers of the Embedder APIp: flutter_plugin_android_lifecycleThe flutter_plugin_android_lifecycle pluginThe flutter_plugin_android_lifecycle pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyAndroid applications specificallyteam-androidOwned by Android platform teamOwned by Android platform teamtriaged-androidTriaged by Android platform teamTriaged by Android platform team