Page MenuHomec4science

MainActivity.java
No OneTemporary

File Metadata

Created
Fri, Dec 27, 21:45

MainActivity.java

package com.example.cellulo_test;
import androidx.annotation.NonNull;
import io.flutter.embedding.android.FlutterActivity;
import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.plugins.GeneratedPluginRegistrant;
import io.flutter.plugin.common.MethodChannel;
import android.content.ContextWrapper;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.PowerManager;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
import android.os.Bundle;
public class MainActivity extends FlutterActivity {
private static final String CHANNEL = "heartbeat.fritz.ai/native";
static{
// System.loadLibrary("native_add");
System.loadLibrary("Qt5Core");
System.loadLibrary("Qt5Bluetooth");
System.loadLibrary("Qt5Gui");
System.loadLibrary("Qt5AndroidExtras");
System.loadLibrary("Qt5Concurrent");
}
@Override
public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine);
new MethodChannel(flutterEngine.getDartExecutor().getBinaryMessenger(), CHANNEL)
.setMethodCallHandler((call, result) -> {
// if (call.method.equals("powerManage")) {
// boolean deviceStatus = getDeviceStatus();
// String myMessage = Boolean.toString(deviceStatus);
// result.success(myMessage);
//}
System.err.println("load library");
result.success("YES");
});
}
private boolean getDeviceStatus() {
boolean deviceStatus = false;
if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) {
PowerManager powerManager = (PowerManager) getSystemService(POWER_SERVICE);
deviceStatus = powerManager.isDeviceIdleMode();
}
return deviceStatus;
}
}
// import androidx.annotation.NonNull;
// import io.flutter.embedding.android.FlutterActivity;
// import io.flutter.embedding.engine.FlutterEngine;
// import io.flutter.plugins.GeneratedPluginRegistrant;
// import android.util.Log;
// public class MainActivity extends FlutterActivity {
// static{
// Log.i("here", "----------------------------------------------------------------------------------- ");
// // System.loadLibrary("cellulo-unity");
// // System.out.print("done");
// }
// @Override
// public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) {
// GeneratedPluginRegistrant.registerWith(flutterEngine);
// }
// // static{
// // System.out.print("load library");
// // System.loadLibrary("cellulo-unity");
// // System.out.print("done");
// // }
// // static {
// // System.err.println("here");
// // try {
// // System.load("libQt5Core.so");
// // } catch (UnsatisfiedLinkError e) {
// // System.err.println("Native code library failed to load.\n" + e);
// // System.exit(1);
// // }
// // }
// }

Event Timeline