Java Code Examples for io.flutter.plugin.common.PluginRegistry.Registrar#messenger()

The following examples show how to use io.flutter.plugin.common.PluginRegistry.Registrar#messenger() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: QrMobileVisionPlugin.java    From flutter_qr_mobile_vision with MIT License 6 votes vote down vote up
private void performRegistration(boolean isVersion1Embedding, Registrar registrar, FlutterPluginBinding flutterPluginBinding, ActivityPluginBinding activityPluginBinding) {
    Log.i(TAG, "Plugin Registration being performed: " +
        "isVersion1Embedding " + isVersion1Embedding +
        ", registrar " + registrar +
        ", flutterPluginBinding " + flutterPluginBinding +
        ", activityPluginBinding " + activityPluginBinding);

    BinaryMessenger messenger;
    if (isVersion1Embedding) {
        messenger = registrar.messenger();
        activity = registrar.activity();
        textures = registrar.textures();
        registrar.addRequestPermissionsResultListener(this);
    } else {
        messenger = flutterPluginBinding.getBinaryMessenger();
        activity = activityPluginBinding.getActivity();
        textures = flutterPluginBinding.getTextureRegistry();
        activityPluginBinding.addRequestPermissionsResultListener(this);
    }
    channel = new MethodChannel(messenger, "com.github.rmtmckenzie/qr_mobile_vision");
    channel.setMethodCallHandler(this);
}
 
Example 2
Source File: EsenseFlutterPlugin.java    From flutter-plugins with MIT License 6 votes vote down vote up
/** Plugin registration. */
public static void registerWith(Registrar registrar) {
  registrar.activity().requestPermissions(new String[]{
          Manifest.permission.ACCESS_COARSE_LOCATION,
          Manifest.permission.ACCESS_FINE_LOCATION,
  }, 0);

  final  ESenseConnectionEventStreamHandler eSenseConnectionEventStreamHandler = new ESenseConnectionEventStreamHandler(registrar);
  final ESenseManagerMethodCallHandler eSenseManagerMethodCallHandler = new ESenseManagerMethodCallHandler(registrar,eSenseConnectionEventStreamHandler);

  final MethodChannel eSenseManagerMethodChannel = new MethodChannel(registrar.messenger(), ESenseManagerMethodChannelName);
  eSenseManagerMethodChannel.setMethodCallHandler(eSenseManagerMethodCallHandler);

  final EventChannel eSenseConnectionEventChannel = new EventChannel(registrar.messenger(), ESenseConnectionEventChannelName);
  eSenseConnectionEventChannel.setStreamHandler(eSenseConnectionEventStreamHandler);

  final EventChannel eSenseEventChannel = new EventChannel(registrar.messenger(), ESenseEventEventChannelName);
  eSenseEventChannel.setStreamHandler(new ESenseEventStreamHandler(eSenseManagerMethodCallHandler));

  final EventChannel eSenseSensorEventChannel = new EventChannel(registrar.messenger(), ESenseSensorEventChannelName);
  eSenseSensorEventChannel.setStreamHandler(new ESenseSensorEventStreamHandler(eSenseManagerMethodCallHandler));
}
 
Example 3
Source File: NativeDeviceOrientationPlugin.java    From flutter_native_device_orientation with MIT License 5 votes vote down vote up
/**
 * Plugin registration.
 */
public static void registerWith(Registrar registrar) {
    final MethodChannel methodChannel = new MethodChannel(registrar.messenger(), METHOD_CHANEL);
    final EventChannel eventChannel = new EventChannel(registrar.messenger(), EVENT_CHANNEL);
    final NativeDeviceOrientationPlugin instance = new NativeDeviceOrientationPlugin(registrar.activeContext());

    methodChannel.setMethodCallHandler(instance);
    eventChannel.setStreamHandler(instance);
}
 
Example 4
Source File: FlutterAmapPlugin.java    From flutter_amap_plugin with MIT License 5 votes vote down vote up
public static void registerWith(Registrar registrar) {
    FlutterAmapPlugin.registrar = registrar;

    final MethodChannel channel = new MethodChannel(registrar.messenger(), MAP_BASE_CHANNEL);
    channel.setMethodCallHandler(new FlutterAmapPlugin((FlutterActivity) registrar.activity()));

    final MethodChannel locChannel = new MethodChannel(registrar.messenger(), LOCATION_CHANNEL_NAME);
    locChannel.setMethodCallHandler(new FlutterAmapPlugin((FlutterActivity) registrar.activity()));
    FlutterAmapPlugin.locChannel = locChannel;

    final MethodChannel routeChannel = new MethodChannel(registrar.messenger(), SEARCH_ROUTE_CHANNEL_NAME);
    routeChannel.setMethodCallHandler(new FlutterAmapPlugin((FlutterActivity) registrar.activity()));
    FlutterAmapPlugin.routeChannel = routeChannel;

    final MethodChannel convertChannel = new MethodChannel(registrar.messenger(), SEARCH_CONVERT_CHANNEL_NAME);
    convertChannel.setMethodCallHandler(new FlutterAmapPlugin((FlutterActivity) registrar.activity()));
    FlutterAmapPlugin.convertChannel = convertChannel;

    final MethodChannel navChannel = new MethodChannel(registrar.messenger(), FlutterAMapNavView.NAV_CHANNEL_NAME);
    navChannel.setMethodCallHandler(new FlutterAmapPlugin((FlutterActivity) registrar.activity()));

    final FlutterAmapPlugin plugin = new FlutterAmapPlugin(root);

    registrar.platformViewRegistry().registerViewFactory(FlutterAMapView.MAP_CHANNEL_NAME,
            new FlutterAMapViewFactory(plugin.state, registrar));
    registrar.platformViewRegistry().registerViewFactory(FlutterAMapNavView.NAV_CHANNEL_NAME,
            new FlutterAMapNavFactory(plugin.state, registrar));
}
 
Example 5
Source File: FlutterQrReaderPlugin.java    From flutter_qr_reader with MIT License 5 votes vote down vote up
/** Plugin registration. */
public static void registerWith(Registrar registrar) {
  final MethodChannel channel = new MethodChannel(registrar.messenger(), CHANNEL_NAME);
  registrar.platformViewRegistry().registerViewFactory(CHANNEL_VIEW_NAME, new QrReaderFactory(registrar));
  final FlutterQrReaderPlugin instance = new FlutterQrReaderPlugin(registrar);
  channel.setMethodCallHandler(instance);
}
 
Example 6
Source File: OtaUpdatePlugin.java    From ota_update with MIT License 5 votes vote down vote up
/**
 * Plugin registration.
 */
public static void registerWith(Registrar registrar) {
    OtaUpdatePlugin plugin = new OtaUpdatePlugin(registrar);
    final EventChannel progressChannel = new EventChannel(registrar.messenger(), "sk.fourq.ota_update");
    progressChannel.setStreamHandler(plugin);
    registrar.addRequestPermissionsResultListener(plugin);
}
 
Example 7
Source File: MusicFinderPlugin.java    From Flute-Music-Player with Apache License 2.0 5 votes vote down vote up
/**
 * Plugin registration.
 */
public static void registerWith(Registrar registrar) {
  final MethodChannel channel = new MethodChannel(registrar.messenger(), "music_finder");
  instance = new MusicFinderPlugin(registrar.activity(), channel);
  registrar.addRequestPermissionsResultListener(instance);
  channel.setMethodCallHandler(instance);

}
 
Example 8
Source File: MediaNotificationPlugin.java    From flutter_media_notification with Apache License 2.0 5 votes vote down vote up
/** Plugin registration. */
public static void registerWith(Registrar registrar) {
  MediaNotificationPlugin plugin = new MediaNotificationPlugin(registrar);

  MediaNotificationPlugin.channel = new MethodChannel(registrar.messenger(), "media_notification");
  MediaNotificationPlugin.channel.setMethodCallHandler(new MediaNotificationPlugin(registrar));
}
 
Example 9
Source File: FirebaseMlkitLanguagePlugin.java    From firebase_mlkit_language with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/** Plugin registration. */
public static void registerWith(Registrar registrar) {
  final MethodChannel channel =
      new MethodChannel(registrar.messenger(), "firebase_mlkit_language");
  channel.setMethodCallHandler(new FirebaseMlkitLanguagePlugin());
}
 
Example 10
Source File: FlutterUmengAnalyticsPlugin.java    From flutter_umeng_analytics with MIT License 4 votes vote down vote up
/**
 * Plugin registration.
 */
public static void registerWith(Registrar registrar) {
    final MethodChannel channel = new MethodChannel(registrar.messenger(), "umeng_analytics_flutter");
    channel.setMethodCallHandler(new FlutterUmengAnalyticsPlugin(registrar.activity()));
}
 
Example 11
Source File: HybridStackManager.java    From hybrid_stack_manager with MIT License 4 votes vote down vote up
public static void registerWith(Registrar registrar) {
    hybridStackManager = HybridStackManager.sharedInstance();
    hybridStackManager.methodChannel = new MethodChannel(registrar.messenger(), "hybrid_stack_manager");
    hybridStackManager.methodChannel.setMethodCallHandler(hybridStackManager);
}
 
Example 12
Source File: PlayGamesPlugin.java    From play_games with MIT License 4 votes vote down vote up
public static void registerWith(Registrar registrar) {
    final MethodChannel channel = new MethodChannel(registrar.messenger(), "play_games");
    channel.setMethodCallHandler(new PlayGamesPlugin(registrar));
}
 
Example 13
Source File: FlutterQiniucloudLivePlugin.java    From FlutterQiniucloudLivePlugin with Apache License 2.0 4 votes vote down vote up
public static void registerWith(Registrar registrar) {
    final MethodChannel channel = new MethodChannel(registrar.messenger(), "flutter_qiniucloud_live_plugin");
    channel.setMethodCallHandler(new FlutterQiniucloudLivePlugin(registrar.messenger(), registrar.context(), channel, registrar.platformViewRegistry()));
}
 
Example 14
Source File: FlutterIncallManagerPlugin.java    From flutter-incall-manager with ISC License 4 votes vote down vote up
public static void registerWith(Registrar registrar) {
    final MethodChannel channel = new MethodChannel(registrar.messenger(), "FlutterInCallManager.Method");
    channel.setMethodCallHandler(new FlutterIncallManagerPlugin(registrar, channel));
}
 
Example 15
Source File: BillingPlugin.java    From flutter_billing with Apache License 2.0 4 votes vote down vote up
public static void registerWith(Registrar registrar) {
    final MethodChannel channel = new MethodChannel(registrar.messenger(), "flutter_billing");
    channel.setMethodCallHandler(new BillingPlugin(registrar.activity()));
}
 
Example 16
Source File: WhatsAppStickersPlugin.java    From flutter_whatsapp_stickers with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public static void registerWith(Registrar registrar) {
    final MethodChannel channel = new MethodChannel(registrar.messenger(),
            "io.github.vincekruger/whatsapp_stickers");
    final WhatsAppStickersPlugin plugin = new WhatsAppStickersPlugin(registrar, channel);
    channel.setMethodCallHandler(plugin);
}
 
Example 17
Source File: TflitePlugin.java    From flutter_tflite with MIT License 4 votes vote down vote up
public static void registerWith(Registrar registrar) {
  final MethodChannel channel = new MethodChannel(registrar.messenger(), "tflite");
  channel.setMethodCallHandler(new TflitePlugin(registrar));
}
 
Example 18
Source File: TencentImPlugin.java    From FlutterTencentImPlugin with Apache License 2.0 4 votes vote down vote up
public static void registerWith(Registrar registrar) {
    final MethodChannel channel = new MethodChannel(registrar.messenger(), "tencent_im_plugin");
    channel.setMethodCallHandler(new TencentImPlugin(registrar.context(), channel));
}
 
Example 19
Source File: JmessageFlutterPlugin.java    From jmessage-flutter-plugin with MIT License 4 votes vote down vote up
/** Plugin registration. */
public static void registerWith(Registrar registrar) {
  final MethodChannel channel = new MethodChannel(registrar.messenger(), "jmessage_flutter");
  channel.setMethodCallHandler(new JmessageFlutterPlugin(registrar, channel));
}
 
Example 20
Source File: FlutterSplashScreenPlugin.java    From flutter_splash_screen with MIT License 4 votes vote down vote up
public static void registerWith(Registrar registrar) {
    final MethodChannel channel = new MethodChannel(registrar.messenger(), "flutter_splash_screen");
    channel.setMethodCallHandler(new FlutterSplashScreenPlugin(registrar.activity()));
}