Reland isolate platform channels with conditional compilation (#111712)
This commit is contained in:
@@ -18,6 +18,7 @@ found in the LICENSE file. -->
|
||||
Application and put your custom class here. -->
|
||||
<application android:name="${applicationName}" android:label="channels" android:icon="@mipmap/ic_launcher">
|
||||
<activity android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@android:style/Theme.Black.NoTitleBar"
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||
|
||||
@@ -29,6 +29,15 @@ public class MainActivity extends FlutterActivity {
|
||||
setupMessageHandshake(new BasicMessageChannel<>(dartExecutor, "std-msg", ExtendedStandardMessageCodec.INSTANCE));
|
||||
setupMethodHandshake(new MethodChannel(dartExecutor, "json-method", JSONMethodCodec.INSTANCE));
|
||||
setupMethodHandshake(new MethodChannel(dartExecutor, "std-method", new StandardMethodCodec(ExtendedStandardMessageCodec.INSTANCE)));
|
||||
|
||||
BasicMessageChannel echoChannel =
|
||||
new BasicMessageChannel(dartExecutor, "std-echo", ExtendedStandardMessageCodec.INSTANCE);
|
||||
echoChannel.setMessageHandler(new BasicMessageChannel.MessageHandler(){
|
||||
@Override
|
||||
public void onMessage(final Object message, final BasicMessageChannel.Reply reply) {
|
||||
reply.reply(message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private <T> void setupMessageHandshake(final BasicMessageChannel<T> channel) {
|
||||
|
||||
Reference in New Issue
Block a user