Get active Context from the Registrar (flutter/engine#4523)
This commit is contained in:
committed by
Mikkel Nygaard Ravn
parent
d595980338
commit
96ef7f6c1a
@@ -5,3 +5,4 @@
|
||||
|
||||
Google Inc.
|
||||
Jim Simon <jim.j.simon@gmail.com>
|
||||
Ali Bitek <alibitek@protonmail.ch>
|
||||
|
||||
@@ -92,6 +92,11 @@ public class FlutterPluginRegistry
|
||||
return mAppContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Context activeContext() {
|
||||
return (mActivity != null) ? mActivity : mAppContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BinaryMessenger messenger() {
|
||||
return mNativeView;
|
||||
|
||||
@@ -80,6 +80,13 @@ public interface PluginRegistry {
|
||||
*/
|
||||
Context context();
|
||||
|
||||
/**
|
||||
* Returns the active {@link Context}.
|
||||
*
|
||||
* @return the current {@link #activity() Activity}, if not null, otherwise the {@link #context() Application}.
|
||||
*/
|
||||
Context activeContext();
|
||||
|
||||
/**
|
||||
* Returns a {@link BinaryMessenger} which the plugin can use for
|
||||
* creating channels for communicating with the Dart side.
|
||||
|
||||
Reference in New Issue
Block a user