Update plugin template to new channel API. (#9105)
This commit is contained in:
@@ -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]]);
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user