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
  • Field Details

  • 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 interface io.flutter.embedding.engine.plugins.FlutterPlugin
    • onDetachedFromEngine

      public void onDetachedFromEngine(@NonNull io.flutter.embedding.engine.plugins.FlutterPlugin.FlutterPluginBinding binding)
      Specified by:
      onDetachedFromEngine in interface io.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 interface io.flutter.plugin.common.MethodChannel.MethodCallHandler
    • onAttachedToActivity

      public void onAttachedToActivity(@NonNull io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding binding)
      Specified by:
      onAttachedToActivity in interface io.flutter.embedding.engine.plugins.activity.ActivityAware
    • onReattachedToActivityForConfigChanges

      public void onReattachedToActivityForConfigChanges(@NonNull io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding binding)
      Specified by:
      onReattachedToActivityForConfigChanges in interface io.flutter.embedding.engine.plugins.activity.ActivityAware
    • onDetachedFromActivity

      public void onDetachedFromActivity()
      Specified by:
      onDetachedFromActivity in interface io.flutter.embedding.engine.plugins.activity.ActivityAware
    • onDetachedFromActivityForConfigChanges

      public void onDetachedFromActivityForConfigChanges()
      Specified by:
      onDetachedFromActivityForConfigChanges in interface io.flutter.embedding.engine.plugins.activity.ActivityAware
    • onNewIntent

      public boolean onNewIntent(Intent intent)
      Specified by:
      onNewIntent in interface io.flutter.plugin.common.PluginRegistry.NewIntentListener
    • setup

      public static boolean setup(@NonNull Context context)
      Ready the plugin for use. This MUST be called in an Application 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) and BatchPluginConfiguration.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

      public static BatchPluginConfiguration getConfiguration(@NonNull Context context)
      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 calling Batch.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 your Application subclass.