public static interface PluginRegistry.Registrar
Modifier and Type | Method and Description |
---|---|
Context |
activeContext()
Returns the active
Context . |
Activity |
activity()
Returns the
Activity that forms the plugin's operating context. |
PluginRegistry.Registrar |
addActivityResultListener(PluginRegistry.ActivityResultListener listener)
Adds a callback allowing the plugin to take part in handling incoming
calls to
Activity.onActivityResult(int, int, Intent) . |
PluginRegistry.Registrar |
addNewIntentListener(PluginRegistry.NewIntentListener listener)
Adds a callback allowing the plugin to take part in handling incoming
calls to
Activity.onNewIntent(Intent) . |
PluginRegistry.Registrar |
addRequestPermissionsResultListener(PluginRegistry.RequestPermissionsResultListener listener)
Adds a callback allowing the plugin to take part in handling incoming
calls to
Activity#onRequestPermissionsResult(int, String[], int[])
or android.support.v4.app.ActivityCompat.OnRequestPermissionsResultCallback#onRequestPermissionsResult(int, String[], int[]) . |
PluginRegistry.Registrar |
addUserLeaveHintListener(PluginRegistry.UserLeaveHintListener listener)
Adds a callback allowing the plugin to take part in handling incoming
calls to
Activity.onUserLeaveHint() . |
PluginRegistry.Registrar |
addViewDestroyListener(PluginRegistry.ViewDestroyListener listener)
Adds a callback allowing the plugin to take part in handling incoming
calls to
Activity.onDestroy() . |
Context |
context()
Returns the
Application 's Context . |
String |
lookupKeyForAsset(String asset)
Returns the file name for the given asset.
|
String |
lookupKeyForAsset(String asset,
String packageName)
Returns the file name for the given asset which originates from the
specified packageName.
|
BinaryMessenger |
messenger()
Returns a
BinaryMessenger which the plugin can use for
creating channels for communicating with the Dart side. |
PlatformViewRegistry |
platformViewRegistry()
Returns the application's
PlatformViewRegistry . |
PluginRegistry.Registrar |
publish(Object value)
Publishes a value associated with the plugin being registered.
|
TextureRegistry |
textures()
Returns a
TextureRegistry which the plugin can use for
managing backend textures. |
FlutterView |
view()
Returns the
FlutterView that's instantiated by this plugin's
activity . |
Activity activity()
Activity
that forms the plugin's operating context.
Plugin authors should not assume the type returned by this method
is any specific subclass of Activity
(such as
FlutterActivity
or
FlutterFragmentActivity
), as applications
are free to use any activity subclass.
When there is no foreground activity in the application, this
will return null. If a Context
is needed, use context() to
get the application's context.
Context context()
Application
's Context
.Context activeContext()
Context
.Activity
, if not null, otherwise the Application
.BinaryMessenger messenger()
BinaryMessenger
which the plugin can use for
creating channels for communicating with the Dart side.TextureRegistry textures()
TextureRegistry
which the plugin can use for
managing backend textures.PlatformViewRegistry platformViewRegistry()
PlatformViewRegistry
.
Plugins can use the platform registry to register their view factories.FlutterView view()
FlutterView
that's instantiated by this plugin's
activity
.String lookupKeyForAsset(String asset)
AssetManager
API.asset
- the name of the asset. The name can be hierarchicalAssetManager
String lookupKeyForAsset(String asset, String packageName)
AssetManager
API.asset
- the name of the asset. The name can be hierarchicalpackageName
- the name of the package from which the asset originatesAssetManager
PluginRegistry.Registrar publish(Object value)
The published value is available to interested clients via
PluginRegistry.valuePublishedByPlugin(String)
.
Publication should be done only when client code needs to interact with the plugin in a way that cannot be accomplished by the plugin registering callbacks with client APIs.
Overwrites any previously published value.
value
- the value, possibly null.PluginRegistry.Registrar
.PluginRegistry.Registrar addRequestPermissionsResultListener(PluginRegistry.RequestPermissionsResultListener listener)
Activity#onRequestPermissionsResult(int, String[], int[])
or android.support.v4.app.ActivityCompat.OnRequestPermissionsResultCallback#onRequestPermissionsResult(int, String[], int[])
.listener
- a PluginRegistry.RequestPermissionsResultListener
callback.PluginRegistry.Registrar
.PluginRegistry.Registrar addActivityResultListener(PluginRegistry.ActivityResultListener listener)
Activity.onActivityResult(int, int, Intent)
.listener
- an PluginRegistry.ActivityResultListener
callback.PluginRegistry.Registrar
.PluginRegistry.Registrar addNewIntentListener(PluginRegistry.NewIntentListener listener)
Activity.onNewIntent(Intent)
.listener
- a PluginRegistry.NewIntentListener
callback.PluginRegistry.Registrar
.PluginRegistry.Registrar addUserLeaveHintListener(PluginRegistry.UserLeaveHintListener listener)
Activity.onUserLeaveHint()
.listener
- a PluginRegistry.UserLeaveHintListener
callback.PluginRegistry.Registrar
.PluginRegistry.Registrar addViewDestroyListener(PluginRegistry.ViewDestroyListener listener)
Activity.onDestroy()
.listener
- a PluginRegistry.ViewDestroyListener
callback.PluginRegistry.Registrar
.