|
|
@@ -1,24 +1,40 @@ |
|
|
|
package com.wxwx.flutter_alibc; |
|
|
|
|
|
|
|
|
|
|
|
import androidx.annotation.NonNull; |
|
|
|
|
|
|
|
import io.flutter.embedding.engine.plugins.FlutterPlugin; |
|
|
|
import io.flutter.plugin.common.MethodCall; |
|
|
|
import io.flutter.plugin.common.MethodChannel; |
|
|
|
import io.flutter.plugin.common.MethodChannel.MethodCallHandler; |
|
|
|
import io.flutter.plugin.common.MethodChannel.Result; |
|
|
|
import io.flutter.plugin.common.PluginRegistry.Registrar; |
|
|
|
|
|
|
|
/** FlutterAlibcPlugin */ |
|
|
|
public class FlutterAlibcPlugin implements MethodCallHandler { |
|
|
|
public class FlutterAlibcPlugin implements FlutterPlugin, MethodChannel.MethodCallHandler { |
|
|
|
|
|
|
|
private static com.wxwx.flutter_alibc.FlutterAlibcHandle handle; |
|
|
|
// private static com.wxwx.flutter_alibc.FlutterAlibcHandle handle; |
|
|
|
/** Plugin registration. */ |
|
|
|
public static void registerWith(Registrar registrar) { |
|
|
|
handle = com.wxwx.flutter_alibc.FlutterAlibcHandle.getInstance(registrar); |
|
|
|
final MethodChannel channel = new MethodChannel(registrar.messenger(), "flutter_alibc"); |
|
|
|
channel.setMethodCallHandler(new FlutterAlibcPlugin()); |
|
|
|
// public static void registerWith(Registrar registrar) { |
|
|
|
// handle = com.wxwx.flutter_alibc.FlutterAlibcHandle.getInstance(registrar); |
|
|
|
// final MethodChannel channel = new MethodChannel(registrar.messenger(), "flutter_alibc"); |
|
|
|
// channel.setMethodCallHandler(new FlutterAlibcPlugin()); |
|
|
|
// } |
|
|
|
private MethodChannel channel; |
|
|
|
private com.wxwx.flutter_alibc.FlutterAlibcHandle handle; |
|
|
|
|
|
|
|
@Override |
|
|
|
public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) { |
|
|
|
channel = new MethodChannel(flutterPluginBinding.getBinaryMessenger(), "zhiying_live_ali"); |
|
|
|
channel.setMethodCallHandler(this); |
|
|
|
handle = new FlutterAlibcHandle(channel); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) { |
|
|
|
channel.setMethodCallHandler(null); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void onMethodCall(MethodCall call, Result result) { |
|
|
|
public void onMethodCall(@NonNull MethodCall call, @NonNull MethodChannel.Result result) { |
|
|
|
if (call.method.equals("getPlatformVersion")) { |
|
|
|
result.success("Android " + android.os.Build.VERSION.RELEASE); |
|
|
|
} else if (call.method.equals("initAlibc")){ |
|
|
|