Flutter Engine
The Flutter Engine
BroadcastReceiverControlSurface.java
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5package io.flutter.embedding.engine.plugins.broadcastreceiver;
6
7import android.content.BroadcastReceiver;
8import androidx.annotation.NonNull;
9import androidx.lifecycle.Lifecycle;
10
11/**
12 * Control surface through which a {@link BroadcastReceiver} attaches to a {@link
13 * io.flutter.embedding.engine.FlutterEngine}.
14 *
15 * <p>A {@link BroadcastReceiver} that contains a {@link io.flutter.embedding.engine.FlutterEngine}
16 * should coordinate itself with the {@link io.flutter.embedding.engine.FlutterEngine}'s {@code
17 * BroadcastReceiverControlSurface}.
18 */
20 /**
21 * Call this method from the {@link BroadcastReceiver} that is running the {@link
22 * io.flutter.embedding.engine.FlutterEngine} that is associated with this {@code
23 * BroadcastReceiverControlSurface}.
24 *
25 * <p>Once a {@link BroadcastReceiver} is created, and its associated {@link
26 * io.flutter.embedding.engine.FlutterEngine} is executing Dart code, the {@link
27 * BroadcastReceiver} should invoke this method. At that point the {@link
28 * io.flutter.embedding.engine.FlutterEngine} is considered "attached" to the {@link
29 * BroadcastReceiver} and all {@link BroadcastReceiverAware} plugins are given access to the
30 * {@link BroadcastReceiver}.
31 */
33 @NonNull BroadcastReceiver broadcastReceiver, @NonNull Lifecycle lifecycle);
34
35 /**
36 * Call this method from the {@link BroadcastReceiver} that is attached to this {@code
37 * BroadcastReceiverControlSurfaces}'s {@link io.flutter.embedding.engine.FlutterEngine} when the
38 * {@link BroadcastReceiver} is about to be destroyed.
39 *
40 * <p>This method gives each {@link BroadcastReceiverAware} plugin an opportunity to clean up its
41 * references before the {@link BroadcastReceiver is destroyed}.
42 */
44}
void attachToBroadcastReceiver( @NonNull BroadcastReceiver broadcastReceiver, @NonNull Lifecycle lifecycle)