Package com.batch.batch_flutter
Class BatchFlutterPlugin
java.lang.Object
com.batch.batch_flutter.BatchFlutterPlugin
- All Implemented Interfaces:
io.flutter.embedding.engine.plugins.activity.ActivityAware
,io.flutter.embedding.engine.plugins.FlutterPlugin
,io.flutter.plugin.common.MethodChannel.MethodCallHandler
,io.flutter.plugin.common.PluginRegistry.NewIntentListener
public class BatchFlutterPlugin
extends Object
implements io.flutter.embedding.engine.plugins.FlutterPlugin, io.flutter.plugin.common.MethodChannel.MethodCallHandler, io.flutter.embedding.engine.plugins.activity.ActivityAware, io.flutter.plugin.common.PluginRegistry.NewIntentListener
BatchFlutterPlugin
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.flutter.embedding.engine.plugins.FlutterPlugin
io.flutter.embedding.engine.plugins.FlutterPlugin.FlutterAssets, io.flutter.embedding.engine.plugins.FlutterPlugin.FlutterPluginBinding
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic BatchPluginConfiguration
getConfiguration
(Context context) Get the plugin configuration object.protected boolean
isSetup()
void
onAttachedToActivity
(io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding binding) void
onAttachedToEngine
(io.flutter.embedding.engine.plugins.FlutterPlugin.FlutterPluginBinding flutterPluginBinding) void
void
void
onDetachedFromEngine
(io.flutter.embedding.engine.plugins.FlutterPlugin.FlutterPluginBinding binding) void
onMethodCall
(io.flutter.plugin.common.MethodCall call, io.flutter.plugin.common.MethodChannel.Result result) boolean
onNewIntent
(Intent intent) void
onReattachedToActivityForConfigChanges
(io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding binding) static void
setManageActivityLifecycle
(boolean manageActivityLifecycle) Set whether BatchFlutterPlugin should automatically manage Batch's activity lifecycle (as in automatically callingBatch.onStart(Activity)
and so on).static boolean
Ready the plugin for use.
-
Field Details
-
currentActivity
-
-
Constructor Details
-
BatchFlutterPlugin
public BatchFlutterPlugin()
-
-
Method Details
-
isSetup
@VisibleForTesting protected boolean isSetup() -
onAttachedToEngine
public void onAttachedToEngine(@NonNull io.flutter.embedding.engine.plugins.FlutterPlugin.FlutterPluginBinding flutterPluginBinding) - Specified by:
onAttachedToEngine
in interfaceio.flutter.embedding.engine.plugins.FlutterPlugin
-
onDetachedFromEngine
public void onDetachedFromEngine(@NonNull io.flutter.embedding.engine.plugins.FlutterPlugin.FlutterPluginBinding binding) - Specified by:
onDetachedFromEngine
in interfaceio.flutter.embedding.engine.plugins.FlutterPlugin
-
onMethodCall
public void onMethodCall(@NonNull io.flutter.plugin.common.MethodCall call, @NonNull io.flutter.plugin.common.MethodChannel.Result result) - Specified by:
onMethodCall
in interfaceio.flutter.plugin.common.MethodChannel.MethodCallHandler
-
onAttachedToActivity
public void onAttachedToActivity(@NonNull io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding binding) - Specified by:
onAttachedToActivity
in interfaceio.flutter.embedding.engine.plugins.activity.ActivityAware
-
onReattachedToActivityForConfigChanges
public void onReattachedToActivityForConfigChanges(@NonNull io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding binding) - Specified by:
onReattachedToActivityForConfigChanges
in interfaceio.flutter.embedding.engine.plugins.activity.ActivityAware
-
onDetachedFromActivity
public void onDetachedFromActivity()- Specified by:
onDetachedFromActivity
in interfaceio.flutter.embedding.engine.plugins.activity.ActivityAware
-
onDetachedFromActivityForConfigChanges
public void onDetachedFromActivityForConfigChanges()- Specified by:
onDetachedFromActivityForConfigChanges
in interfaceio.flutter.embedding.engine.plugins.activity.ActivityAware
-
onNewIntent
- Specified by:
onNewIntent
in interfaceio.flutter.plugin.common.PluginRegistry.NewIntentListener
-
setup
Ready the plugin for use. This MUST be called in anApplication
subclass'Application.onCreate()
.Once setup success fully, the configuration cannot be changed anymore as this calls
Batch.start(String)
Note: If setup has never been called, or if Batch wasn't provided an APIKey in the manifest or using
getConfiguration(Context)
andBatchPluginConfiguration.setAPIKey(String)
, any method call will throw an exception.- Returns:
- Whether the plugin was successfully setup. Returns true on any subsequent call if one setup call succeeded.
-
getConfiguration
Get the plugin configuration object. It will be initialized with the previous values, including what has been read from the manifest.Once
setup(Context)
has been called, changing values in the returned object will not have any effect. -
setManageActivityLifecycle
public static void setManageActivityLifecycle(boolean manageActivityLifecycle) Set whether BatchFlutterPlugin should automatically manage Batch's activity lifecycle (as in automatically callingBatch.onStart(Activity)
and so on).If you add batch_flutter in a hybrid application (one that mixes native android activities with flutter ones), you should turn this off and register
BatchActivityLifecycleHelper
in yourApplication
subclass.
-