Desde flutter
class QRPlatformChannel {
static const platform = MethodChannel('app.nodriza_appexample/qr_platform_channel');
Future<void> lectorPDA() async {
try {
var result = await platform.invokeMethod('lector_qr');
print(result);
} catch (e) {
// log.w(e);
}
}
}
public class MainActivity extends FlutterActivity {
private static final String CHANNEL = "app.nodriza_appexample/qr_platform_channel";
// Barcode2D barcode2D;
BarcodeUtility barcodeUtility = null;
@Override
public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) {
super.configureFlutterEngine(flutterEngine);
new MethodChannel(flutterEngine.getDartExecutor().getBinaryMessenger(), CHANNEL)
.setMethodCallHandler(
(call, result) -> {
if (call.method.equals("lector_qr")) {
barcodeUtility = BarcodeUtility.getInstance();
barcodeUtility.setOutputMode(this, 0);
barcodeUtility.open(this, BarcodeUtility.ModuleType.BARCODE_2D);
barcodeUtility.enablePlaySuccessSound(this, true);
barcodeUtility.enableContinuousScan(this, false);
barcodeUtility.enableEnter(this, false);
barcodeUtility.enableVibrate(this, true);
result.success("Configurar PDA");
} else {
result.notImplemented();
}
});
}
}