Commit 104e7ba5 authored by Jakob Andersen's avatar Jakob Andersen Committed by GitHub

Update plugin template to new channel API. (#9105)

parent 0ee7fabe
......@@ -30,3 +30,7 @@ android {
disable 'InvalidPackage'
}
}
dependencies {
compile 'com.android.support:support-fragment:25.0.0'
}
......@@ -29,7 +29,7 @@ public class {{pluginClass}} implements MethodCallHandler {
if (call.method.equals("getPlatformVersion")) {
response.success("Android " + android.os.Build.VERSION.RELEASE);
} else {
throw new IllegalArgumentException("Unknown method " + call.method);
response.notImplemented();
}
}
}
......@@ -7,15 +7,13 @@
self = [super init];
if (self) {
FlutterMethodChannel *channel = [FlutterMethodChannel
methodChannelNamed:@"{{projectName}}"
binaryMessenger:flutterView
codec:[FlutterStandardMethodCodec sharedInstance]];
methodChannelWithName:@"{{projectName}}"
binaryMessenger:flutterView];
[channel setMethodCallHandler:^(FlutterMethodCall *call,
FlutterResultReceiver result) {
if ([@"getPlatformVersion" isEqualToString:call.method]) {
result([@"iOS " stringByAppendingString:[[UIDevice currentDevice]
systemVersion]],
nil);
systemVersion]]);
}
}];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment