chrome.serial not available in Chrome packaged application - javascript

I'm building a Chrome packaged application with an Arduino serial connection. Similar to what was demonstrated in the latest Google I/O, The Next Evolution of Chrome Apps by Erik Kay, and Mihai Parparita.
I'm using the latest Canary build (23.0.1254.0) on OS X 10.8 (Mountain Lion).
However, the 'chrome' object is missing the 'serial' member.

The 'serial' permission is missing from the manifest.json :
"permissions": ["serial"]

I've successfully connected to serial from a packaged plugin designed to work with arduino however for compilation of code requires a server.
Then Chrome plugin is here:
https://github.com/DecodedCo/ArduinoInTheBrowser

Related

Launching on android WEBAPP with ADB

Is there a method to launch a web app using adb?
The web app is created using manifest.json and save on android using chrome browser.
I've tried to get the package name of the web application using adb shell pm list packages but nothing seems to match.
I want to launch my web app this way adb shell am start -n com.package.name/com.package.name.ActivityName
I've also tried this way adb shell am start -a android.intent.action.VIEW -d "url". This works but it is not what I am looking for.
Assuming you are coming from Javascript world (as you could have done this by looking at adb logs), this should be what you are looking for
adb shell am start -a com.google.android.apps.chrome.webapps.WebappManager.ACTION_START_WEBAPP -n com.android.chrome/org.chromium.chrome.browser.webapps.WebappLauncherActivity --es "org.chromium.chrome.browser.webapp_url" "{your_url}" --es "org.chromium.chrome.browser.webapp_mac" "{webapp_mac}"
Note that this url has to match the url/url-ending you have mentioned in the start_url that you have mentioned in the manifest.json of yours, else it will just open it as another chrome tab.
Another caveat here is you have to pass web app mac validation check, which is done by the core android class mentioned here - WebappAuthenticator
Chrome does not keep a store of valid URLs for installed web apps
(because it cannot know when any have been uninstalled). Therefore,
upon installation, it tells the Launcher a message authentication code
(MAC) along with the URL for the web app, and then Chrome can verify
the MAC when starting e.g. {#link #FullScreenActivity}. Chrome can
thus distinguish between legitimate, installed web apps and arbitrary
other URLs.
I gave it a shot to open one of the webapps I own. I gave up after a bit, getting lost in the cryptic algos. Maybe you will have some luck with it. All the best!!!

How to debug JavaScript errors when running a Cordova App on Android TV

I have written a Javascript script which I bundled into an Android app using Cordova.
The code is written in ES6 and is transpiled into ES5 using Babel and Webpack.
The app is intended to run on a simple TV, so I am using MK809 Android dongle to transform a TV into an Android-based TV. Then I install the new app and try to run it.
The problem is that the app terminates immediately (most probably due to some ES5 errors as the transpilation is probaby not complete or correct).
Is there a way this can be debugged?
When I run it on my computer's Chome, everything works perfectly as it has full ES6 support. The app also runs perfectly on my Android phone as it uses a modern browser which supports ES6.
I am not a FE guy, so my knowledge is a bit limited.
Can anyone suggest the best way to debug this? How can I run a local copy of a brower with ES6 disabled so that I could easily spot the problem?
Thank you
The only I see you could achieve this would be to root this Android dongle and install something like ADBWifi so you can debug it through Chrome/ADB over your local network. This is what I do for ChromeOS devices, not too sure if it's doable with your device...
I found out that using a service like errlog.io gives me what I need.
JavaScript errors get captured and sent to the their service and then are accessible on the dashboard
see: Get Started with Remote Debugging Android Devices
the MK809 dongle has an USB port and it would need to have USB debugging enabled.
then go to chrome://inspect on the computer's Chrome, in order to access the debugger.
logging and debugging is something very else; that dongle actually is a Rockchip RK3066.

electron + simplewebrtc workable?

Does anyone use electron + simplewebrtc successfully?
I used simplewebrtc to build a web app. It works fine in browsers.
When I migrated it into electron, something weird happened.
At first I used two copies of my electron app to make them connect each other, but failed.
Then, I made a web browser version and a electron version connect each other.
First, only when the electron version joined the room first, and then made the web version join the room, they can connect each other. otherwise, if the order changes, they cannot get the event peer.pc.iceConnectionState to "connected".
Second, even if them are connected, data channel only works on one way. Only web version can send message to electron version. If I try to let electron version send a message to web version, nothing happened.
During the whole time, no any error was thrown.
Thank you in advance.
simplewebrtc 2.2.3 - 3.0.1
Electron: 1.7.6
Web browsers: Chrome 62, Opera 49, Chromium 58

How to debug Node.js with Firefox?

I'm aware of how to access the Chrome Dev Tools with Google Chrome to debug Node.js applications: just go to about://inspect.
I encountered a line of text on MDN mentioning that Firefox could be used for Node.js applications, but going to about://inspect in Firefox doesn't work. I'd like to know how this would be done in Firefox, if it is indeed possible.
Because Firefox uses a different Javascript engine (Gecko) than Node.js (V8), it's impossible to use the Firefox dev tools to debug Node scripts. As of this post, MDN says as much in their "Remote Debugging" article:
You can connect the developer tools to Gecko-based runtimes...
https://developer.mozilla.org/en-US/docs/Tools/Remote_Debugging
There's a tool called node-firefox that you can use for that, you can download it from:
npm install node-firefox
Here's the source code: https://github.com/mozilla/node-firefox
And a introductory guide: https://hacks.mozilla.org/2015/02/introducing-node-firefox/

How to debug remote v8-based application using Chrome Dev Tools

v8 has its own JSON based remote-debugging protocol and two UI debuggers:console application D8 and a eclipse plugin(hosted at http://code.google.com/p/chromedevtools)
Chrome use WebKit Remote Debugging Protocol including Console, DOM Debugger, ..., Debugger
"WebKit Remote Debugging Protocol" is a Google Chrome/Chromium debug protocol. You will find its description at http://developers.google.com/chrome-developer-tools/docs/remote-debugging
So is it possible to use the Chrome Dev Tools ships with chrome to debug remote v8-based application?
Try Node Webkit Agent for NodeJS version >= 0.6
Node-inspector is for NodeJS version 0.4
The setup need to be set in your node server and access the URL provided by the library base on your node version. You cannot use Developer Tools in Chrome directly.
node-inspector is designed to do exactly what you ask.
It seems that it competes with Node Webkit Agent. I haven't tried webkit agent yet as it seems newer and it failed to install without some meddling. node-inspector worked for me, and fairly well, although there is a bit of latency from running a statement to getting the output marshaled into Chrome's debugger. Overall, it's an extremely useful tool.

Categories