コード例 #1
0
 private void postRun() {
   Core core = CoreImpl.getInstance();
   // Connect to the ApplicationMessages service exported by the Flutter framework
   Pair<ApplicationMessages.Proxy, InterfaceRequest<ApplicationMessages>> appMessages =
       ApplicationMessages.MANAGER.getInterfaceRequest(core);
   mDartServiceProvider.connectToService(
       ApplicationMessages.MANAGER.getName(), appMessages.second.passHandle());
   mFlutterAppMessages = appMessages.first;
 }
コード例 #2
0
  private void configureLocalServices(ServiceRegistry registry) {
    registry.register(
        Keyboard.MANAGER.getName(),
        new ServiceFactory() {
          @Override
          public Binding connectToService(FlutterView view, Core core, MessagePipeHandle pipe) {
            return Keyboard.MANAGER.bind(new KeyboardImpl(view.getContext(), mKeyboardState), pipe);
          }
        });

    registry.register(
        RawKeyboardService.MANAGER.getName(),
        new ServiceFactory() {
          @Override
          public Binding connectToService(FlutterView view, Core core, MessagePipeHandle pipe) {
            return RawKeyboardService.MANAGER.bind(
                new RawKeyboardServiceImpl(mRawKeyboardState), pipe);
          }
        });

    registry.register(
        ApplicationMessages.MANAGER.getName(),
        new ServiceFactory() {
          @Override
          public Binding connectToService(FlutterView view, Core core, MessagePipeHandle pipe) {
            return ApplicationMessages.MANAGER.bind(new ApplicationMessagesImpl(), pipe);
          }
        });
  }