Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96545336
MainActivity.java
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Dec 27, 21:45
Size
2 KB
Mime Type
text/x-java
Expires
Sun, Dec 29, 21:45 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23203671
Attached To
R10677 cellulo-flutter
MainActivity.java
View Options
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
Log In to Comment