Re: [codenameone-discussions] Re: BrowserComponent.execute() that works into the simulator but fails on a real android device

2018-04-10 Thread Thomas
Changing const socket to window.socket solved the issue. Thanks a lot! Regarding the javascript logging, it is partially working on the device now (so part of the problem seems to have been linked to the const socket instead of window.socket because changing that changed the javascript logging

Re: [codenameone-discussions] Re: BrowserComponent.execute() that works into the simulator but fails on a real android device

2018-04-09 Thread Steve Hannah
Just looking at your code. Not sure why logging isn't working for you, but this code which instantiates your socket, may be problematic: internalBrowser.execute("const socket = io('"+server_url+"')"); There is no guarantee that the Javascript expression executed in BrowserComponent.execute() is

Re: [codenameone-discussions] Re: BrowserComponent.execute() that works into the simulator but fails on a real android device

2018-04-06 Thread Shai Almog
Steve is better at these things so I'll leave it to him. I do agree that debugging JS <-> Java is a pain in the neck. We made several attempts at simplifying it but mostly focusing around debugging on the simulator. Is it possible that this is failing due to same origin? I doubt that's the

Re: [codenameone-discussions] Re: BrowserComponent.execute() that works into the simulator but fails on a real android device

2018-04-06 Thread Thomas
Thanks. I tested and the issue I had with the null origin is now gone. Meaning that internalBrowser.setProperty("AllowUniversalAccessFromFileURLs", Boolean.TRUE); is now probably correctly taken into account. However, I still can't make socket.io to work when using it on a real device. First

Re: [codenameone-discussions] Re: BrowserComponent.execute() that works into the simulator but fails on a real android device

2018-04-05 Thread Shai Almog
FYI this is deployed and should work now. -- You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group. To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discussions+unsubscr...@googlegroups.com. Visit

Re: [codenameone-discussions] Re: BrowserComponent.execute() that works into the simulator but fails on a real android device

2018-04-05 Thread Steve Hannah
Try calling myBrowserComponent.setProperty("AllowUniversalAccessFromFileURLs", Boolean.TRUE); (on the BrowserComponent) Before loading the page. Ref: https://stackoverflow.com/a/13740831/2935174 On Wed, Apr 4, 2018 at 9:36 PM, Thomas wrote: > I tested my code again

[codenameone-discussions] Re: BrowserComponent.execute() that works into the simulator but fails on a real android device

2018-04-04 Thread Thomas
I tested my code again today (I was preparing something to post for you on github) and surprise!: The CN1 app was able to communicate with my socket.io server and I the javascript logs where correctly output in my device adb logcat (meaning BrowserComponent.execute() javascript calls where

[codenameone-discussions] Re: BrowserComponent.execute() that works into the simulator but fails on a real android device

2018-04-03 Thread Shai Almog
There are some nuances with JS on device and external JS libraries. This is designed to prevent some security weaknesses but makes some code really awkward. How did you include the JS code into the page? How is the HTML structured? Can you post something to github so we can have a look? --