本文整理汇总了Java中io.flutter.plugin.common.MethodChannel类的典型用法代码示例。如果您正苦于以下问题:Java MethodChannel类的具体用法?Java MethodChannel怎么用?Java MethodChannel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MethodChannel类属于io.flutter.plugin.common包,在下文中一共展示了MethodChannel类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loginResultCallback
import io.flutter.plugin.common.MethodChannel; //导入依赖的package包/类
public static FacebookCallback<LoginResult> loginResultCallback(final MethodChannel.Result result, final OnLoginSuccessListener onLoginSuccess) {
return new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
onLoginSuccess.onLoginResult(loginResult);
}
@Override
public void onCancel() {
result.error(TAG, "Cancelled", null);
}
@Override
public void onError(FacebookException exception) {
result.error(TAG, exception.getMessage(), null);
}
};
}
示例2: registerWith
import io.flutter.plugin.common.MethodChannel; //导入依赖的package包/类
public static void registerWith(PluginRegistry.Registrar registrar) {
if (instance == null) {
final MethodChannel channel = new MethodChannel(registrar.messenger(), CHANNEL);
instance = new QRCodeReaderPlugin((FlutterActivity) registrar.activity());
registrar.addActivityResultListener(instance);
registrar.addRequestPermissionResultListener(instance);
channel.setMethodCallHandler(instance);
}
}
示例3: registerWith
import io.flutter.plugin.common.MethodChannel; //导入依赖的package包/类
/**
* Plugin registration.
*/
public static void registerWith(Registrar registrar) {
final MethodChannel channel = new MethodChannel(registrar.messenger(), "apn_fb_login");
final ApnFbLoginPlugin instance = new ApnFbLoginPlugin(registrar.activity());
registrar.addActivityResultListener(instance);
channel.setMethodCallHandler(instance);
}
示例4: registerWith
import io.flutter.plugin.common.MethodChannel; //导入依赖的package包/类
/**
* Plugin registration.
*/
public static void registerWith(Registrar registrar) {
final MethodChannel channel = new MethodChannel(registrar.messenger(), CHANNEL);
channel.setMethodCallHandler(new GpsCoordinatesPlugin(registrar.activity()));
}