ffi work
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package com.veilid.veilid
|
||||
|
||||
import androidx.annotation.NonNull
|
||||
|
||||
import android.content.Context
|
||||
import io.flutter.embedding.engine.plugins.FlutterPlugin
|
||||
import io.flutter.plugin.common.MethodCall
|
||||
import io.flutter.plugin.common.MethodChannel
|
||||
@@ -10,32 +10,23 @@ import io.flutter.plugin.common.MethodChannel.Result
|
||||
|
||||
/** VeilidPlugin */
|
||||
class VeilidPlugin: FlutterPlugin, MethodCallHandler {
|
||||
/// The MethodChannel that will the communication between Flutter and native Android
|
||||
///
|
||||
/// This local reference serves to register the plugin with the Flutter Engine and unregister it
|
||||
/// when the Flutter Engine is detached from the Activity
|
||||
// private lateinit var channel : MethodChannel
|
||||
|
||||
class object {
|
||||
{
|
||||
System.loadLibrary("veilid_flutter");
|
||||
}
|
||||
}
|
||||
|
||||
// static {
|
||||
// System.loadLibrary("veilid_flutter");
|
||||
// }
|
||||
// xxx get main activity
|
||||
// private static native void init_android(Context context);
|
||||
native fun init_android(ctx: Context)
|
||||
|
||||
override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) {
|
||||
// channel = MethodChannel(flutterPluginBinding.binaryMessenger, "veilid")
|
||||
// channel.setMethodCallHandler(this)
|
||||
init_android(flutterPluginBinding.getApplicationContext())
|
||||
}
|
||||
|
||||
override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) {
|
||||
// if (call.method == "getPlatformVersion") {
|
||||
// result.success("Android ${android.os.Build.VERSION.RELEASE}")
|
||||
// } else {
|
||||
result.notImplemented()
|
||||
// }
|
||||
}
|
||||
|
||||
override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) {
|
||||
// channel.setMethodCallHandler(null)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user