Open gcostaapps opened 2 years ago
Hi @gcostaapps thank you for your attention.
What happened when you run the example?
@jiusanzhou , The example app had the buttons to start the floating items disabled, only the debug was enabled but it didn't work.
When I try to run the code that I posted, I can run but when I click to create and start the windows nothing happens.
The flutter engine for window needs a little bit time to get started. In the example, I registered a handle to set the button available while the created event emitted. If it's always unavailable, maybe there's something wrong.
I tested the example in flutter 2, maybe the plugin doesn't work well in flutter 3. I will test it with flutter 3 on this weekend.
@gcostaapps I found the issue, in the example forget to check and grant the permission.
I have fixed it, you can try it.
Thank you again.
Hi @jiusanzhou , I've updated the code but the 'Open' button is still disabled. Even after I grant permission and tap the start button. Below are the logs
Connecting to VM Service at ws://127.0.0.1:59112/ziwE6MEyGbM=/ws
D/FloatwingPlugin(30781): [plugin] pixel radio need to be saved
D/eglCodecCommon(30781): setVertexArrayObject: set vao to 0 (0) 1 0
D/EGL_emulation(30781): eglMakeCurrent: 0xe021a240: ver 3 0 (tinfo 0xe020f220)
D/eglCodecCommon(30781): setVertexArrayObject: set vao to 0 (0) 1 0
[log] [plugin] initialize result: {permission_grated: false, pixel_radio_updated: true, system_config_updated: true, service_running: false, windows: null}
[log] [plugin] there are 0 windows already started
D/EGL_emulation(30781): eglMakeCurrent: 0xe021a240: ver 3 0 (tinfo 0xe020f220)
D/EGL_emulation(30781): eglMakeCurrent: 0xf34534a0: ver 3 0 (tinfo 0xf34892e0)
D/EGL_emulation(30781): eglMakeCurrent: 0xf34534a0: ver 3 0 (tinfo 0xf34892e0)
D/EGL_emulation(30781): eglMakeCurrent: 0xe021a240: ver 3 0 (tinfo 0xe020f220)
D/FloatwingService(30781): [service] wait for service created
D/FloatwingService(30781): [service] wait for service created
I/flutter (30781): start the backgroud service success.
I/FloatwingService(30781): [service] create a window: normal {entry=main, route=/normal, draggable=true}
D/FloatwingService(30781): [service] wait for service created
[log] [event] register listener window.created for Window[normal]@228681343, EventManager@1006652032, config: {"entry":"main","route":"/normal","draggable":true}
[log] [event] register listener window.created for Window[assitive_touch]@636263486, EventManager@1006652032, config: {"entry":"main","route":"/assitive_touch","draggable":true}
[log] [event] register listener window.created for Window[night]@219634324, EventManager@1006652032, config: {"entry":"main","route":"/night","width":-1,"height":-1,"clickable":false}
I/FloatwingService(30781): [service] create a window: assitive_touch {entry=main, route=/assitive_touch, draggable=true}
D/FloatwingService(30781): [service] wait for service created
I/FloatwingService(30781): [service] create a window: night {clickable=false, entry=main, route=/night, width=-1, height=-1}
D/FloatwingService(30781): [service] wait for service created
Hi @gcostaapps, According to the information in the log, it should be that the service failed to start. What version of android are you using?
The normal log should be,
D/FloatwingService(19841): [service] wait for service created
I/FloatwingService(19841): [service] the background service onCreate
D/FloatwingService(19841): [service] load the pixel radio: 2.0
D/FloatwingService(19841): [service] install the service handler for main engine
D/FloatwingService(19841): [service] set service as handler im.zoe.labs/flutter_floatwing/window for io.flutter.embedding.engine.FlutterEngine@4879e2
I/flutter (19841): start the backgroud service success.
I/FloatwingService(19841): [service] create a window: normal {entry=main, route=/normal, draggable=true}
D/FloatwingService(19841): [service] miss from cache need to create a new flutter engine
I/FloatwingService(19841): [service] start flutter engine, id: floatwing_flutter_engine_normal entrypoint: main, route: /normal
D/FloatwingPlugin(19841): [plugin] on attached to window engine
D/FloatwingService(19841): [service] set window as handler im.zoe.labs/flutter_floatwing/window for io.flutter.embedding.engine.FlutterEngine@68a2bab
D/FloatwingService(19841): [service] created window: normal {focusable=false, entry=main, route=/normal, draggable=true}
I/FloatwingService(19841): [service] create a window: assitive_touch {entry=main, route=/assitive_touch, draggable=true}
D/FloatwingService(19841): [service] miss from cache need to create a new flutter engine
I/FloatwingService(19841): [service] start flutter engine, id: floatwing_flutter_engine_assitive_touch entrypoint: main, route: /assitive_touch
D/FloatwingPlugin(19841): [plugin] on attached to window engine
D/FloatwingService(19841): [service] set window as handler im.zoe.labs/flutter_floatwing/window for io.flutter.embedding.engine.FlutterEngine@1459bc6
D/FloatwingService(19841): [service] created window: assitive_touch {focusable=false, entry=main, route=/assitive_touch, draggable=true}
I/FloatwingService(19841): [service] create a window: night {clickable=false, entry=main, route=/night, width=-1, height=-1}
D/FloatwingService(19841): [service] miss from cache need to create a new flutter engine
I/FloatwingService(19841): [service] start flutter engine, id: floatwing_flutter_engine_night entrypoint: main, route: /night
D/FloatwingPlugin(19841): [plugin] on attached to window engine
D/FloatwingService(19841): [service] set window as handler im.zoe.labs/flutter_floatwing/window for io.flutter.embedding.engine.FlutterEngine@b4eb2dd
D/FloatwingService(19841): [service] created window: night {clickable=false, focusable=false, entry=main, route=/night, width=-1, height=-1}
Hi @jiusanzhou ,
I've downloaded the entire library an ran the example app from that and it worked! I don't know if master version is different from pub (as I was using pub version) but since it's working here I can find what I need to do. Thanks for the support and this great package!
Hi @jiusanzhou ,
I've downloaded the entire library an ran the example app from that and it worked! I don't know if master version is different from pub (as I was using pub version) but since it's working here I can find what I need to do. Thanks for the support and this great package!
Add the following line in your AndroidManifest.xml
<service android:name="im.zoe.labs.flutter_floatwing.FloatwingService" android:label="Floatwing Service"/>
Adding this <service android:name="im.zoe.labs.flutter_floatwing.FloatwingService" android:label="Floatwing Service"/>
enables normal
but assistive
panel is still disabled.
@oavasquez @jiusanzhou
@psovit Hi, did you get any errors?
Hi @jiusanzhou , Yes, I am getting this error:
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(error, java.lang.Integer cannot be cast to java.lang.Long, null, java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long
E/flutter (31126): at im.zoe.labs.flutter_floatwing.FloatWindow$Config$Companion.from(FloatWindow.kt:501)
E/flutter (31126): at im.zoe.labs.flutter_floatwing.FlutterFloatwingPlugin.onMethodCall(FlutterFloatwingPlugin.kt:151)
E/flutter (31126): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:261)
E/flutter (31126): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/flutter (31126): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:321)
E/flutter (31126): at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/flutter (31126): at android.os.Handler.handleCallback(Handler.java:938)
E/flutter (31126): at android.os.Handler.dispatchMessage(Handler.java:99)
E/flutter (31126): at android.os.Looper.loop(Looper.java:223)
E/flutter (31126): at android.app.ActivityThread.main(ActivityThread.java:7656)
E/flutter (31126): at java.lang.reflect.Method.invoke(Native Method)
E/flutter (31126): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/flutter (31126): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
E/flutter (31126): )
E/flutter (31126): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:653:7)
E/flutter (31126): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:296:18)
E/flutter (31126): <asynchronous suspension>
E/flutter (31126): #2 MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart:499:43)
E/flutter (31126): <asynchronous suspension>
E/flutter (31126): #3 FloatwingPlugin.internalCreateWindow (package:floating/package/src/plugin.dart:187:19)
E/flutter (31126): <asynchronous suspension>
E/flutter (31126): #4 FloatwingPlugin.createWindow (package:floating/package/src/plugin.dart:157:11)
E/flutter (31126): <asynchronous suspension>
E/flutter (31126): #5 Window.create (package:floating/package/src/window.dart:93:12)
E/flutter (31126): <asynchronous suspension>
E/flutter (31126):
Ok, found the issue which has a simple fix.
In your FloatWindow.kt
class, you have cfg.callback = data["callback"] as Long?
. This is throwing the java.lang.ClassCastException
in Flutter environment : sdk: ">=2.12.0 <3.0.0"
.
Converting Int?
seems to solve this issue:
val int_callback = data["callback"] as Int?
cfg.callback = int_callback?.toLong()
@jiusanzhou
Hi, I downloaded your entire project from your repository, I run it in Flutter 2.5.3,buit it show these errors:
I think the erro was from here:
But I can run it well in Flutter 3.3.3. @jiusanzhou
Example Window not displayed: error log: Unable to match the desired swap behavior.
What is the reason for this?
For people having trouble running the example app in the latest Flutter, it is working for me after upgrading Gradle config. See PR #23
Hi, great package!
I tried to run the example app and couldn't run it. So I've decided to create a minimal app based on the docs but couldn't run either.
I'm using the views for example folder and this is the code that I'm using for the main app
If I click in the play button, then plus, then minimize, these are the logs that I'm getting:
What am I doing wrong? The permission is added in the AndroidManifest and granted in the initState dialog.
I'm using Flutter 3.0 and created a new project.