GithubHelp home page GithubHelp logo

Comments (11)

xiaojieonly avatar xiaojieonly commented on July 19, 2024

Greetings,

I am trying to send data from overlay to main app. My use case is that whe I tap the overlay, I call: await FlutterOverlayWindow("capture");

Then I the initState of the home widget of the main App, I am listening to the overlay listener FlutterOverlayWindow.overlayListener.listen((event) { print("Overlay $event"); });

Unfortunately, the listener (in the main app) is not triggering when I call shareData (from the overlay).

Please help! 😭 TIA

FlutterOverlayWindow.shareData('7hajhsb'); useless too

from flutter_overlay_window.

zees98 avatar zees98 commented on July 19, 2024

Greetings,
I am trying to send data from overlay to main app. My use case is that whe I tap the overlay, I call: await FlutterOverlayWindow("capture");
Then I the initState of the home widget of the main App, I am listening to the overlay listener FlutterOverlayWindow.overlayListener.listen((event) { print("Overlay $event"); });
Unfortunately, the listener (in the main app) is not triggering when I call shareData (from the overlay).
Please help! 😭 TIA

FlutterOverlayWindow.shareData('7hajhsb'); useless too

I meant to type FlutterOverlayWindow.shareData('capture');
Sorry for the typo.

from flutter_overlay_window.

zees98 avatar zees98 commented on July 19, 2024

I was able to communicate between overlay and the app using sockets. My Main App creates a socket server and the overlay connects to that socket server.

My use case was that I wanted to invoke a native method by pressing the overlay. So what happens now is that, when I tap the overlay, it send a string over the socket connection and when my main app receives the message, it decides which native method to invoke.

I know this is not a fix, but rather a workaround in case the fix is not coming around any time soon. Hope it helps.

from flutter_overlay_window.

X-SLAYER avatar X-SLAYER commented on July 19, 2024

hello sorry for that i will try to check and fix that asap you can use the workaround of the socket until the bug get fixed

from flutter_overlay_window.

zees98 avatar zees98 commented on July 19, 2024

hello sorry for that i will try to check and fix that asap you can use the workaround of the socket until the bug get fixed

No problem mate take your time 👌🏻
Good luck🤞🏻

from flutter_overlay_window.

Karlo-T avatar Karlo-T commented on July 19, 2024

Hello, has this problem been solved? Or if not can someone explain how to communicate between overlay and the app using sockets.

What I want to achieve is that when button on overlay is clicked, then text on my main app has to change.

from flutter_overlay_window.

rnrllah07 avatar rnrllah07 commented on July 19, 2024

I was able to communicate between overlay and the app using sockets. My Main App creates a socket server and the overlay connects to that socket server.

My use case was that I wanted to invoke a native method by pressing the overlay. So what happens now is that, when I tap the overlay, it send a string over the socket connection and when my main app receives the message, it decides which native method to invoke.

I know this is not a fix, but rather a workaround in case the fix is not coming around any time soon. Hope it helps.

I have a question for this. I am trying this package. are we use local socket? and do you have example code for this? and ı need help

from flutter_overlay_window.

vinhbui1 avatar vinhbui1 commented on July 19, 2024

any update ? I have the same issue here

from flutter_overlay_window.

vinhbui1 avatar vinhbui1 commented on July 19, 2024

I have a question for this. I am trying this package. are we use local socket? and do you have example code for this? and ı need help

Example for use socket communicate between overlay and the app . Pls check this . (https://medium.com/flutter-community/working-with-sockets-in-dart-15b443007bc9)

from flutter_overlay_window.

dorlanpabon avatar dorlanpabon commented on July 19, 2024

Amigos pueden usar al comunicación mediante puertos Isolate.

Overlay********
En mi caso uso en overlay los siguiente atributos.

  static const String _kPortName = 'overlay_port';
  final _receivePort = ReceivePort();
  static const String _kPortNameHome = 'home_port';
  SendPort? homePort;

En initiState del overlay registro el puerto con el nombre;

IsolateNameServer.registerPortWithName(_receivePort.sendPort, _kPortName);

_receivePort.listen((message) {
 //Aqui se recibe los mensajes del enviados del home al overlay
  print("message overlay: $message");
});

En el evento onTop() de algun widget del overlay, trato de obtener el puerto del home o main, como ustedes lo usen.

homePort ??= IsolateNameServer.lookupPortByName(_kPortNameHome);

##para enviar mensaje del overlay al home usen, luego de haber registrado su homePort con la linea anterior.

homePort.send("texto"), homePort.send(list), homePort.send( { pro:"prop" } ), etc...

MAIN o Home o como lo usen****

Propiedades del main, o home, o como lo usen.

static const String _kPortName = 'overlay_port';
final _receivePort = ReceivePort();
static const String _kPortNameHome = 'home_port';
SendPort? homePort;

metodo initState

IsolateNameServer.registerPortWithName(_receivePort.sendPort, _kPortName);

_receivePort.listen((message) {
 //Aqui se recibe los mensajes del enviados del overlay al home
  print("message overlay: $message");
});

##para enviar mensaje del home al overlay usen lo siguiente:

overlayPort.send("texto"), overlayPort.send(list), overlayPort.send( { pro:"prop" } ), etc...

from flutter_overlay_window.

X-SLAYER avatar X-SLAYER commented on July 19, 2024

#46 (comment)

from flutter_overlay_window.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.