[Cordova][cli] Add "open from command line" to Simulator

RESOLVED WONTFIX

Status

Developer Ecosystem
Dev Kit
RESOLVED WONTFIX
5 years ago
2 years ago

People

(Reporter: wenzel, Unassigned)

Tracking

Details

(Reporter)

Description

5 years ago
For "cordova emulate firefoxos", we need to be able to open an app from the command line in the Simulator.

This bug is a placeholder for this Issue I filed on r2d2b2g:

https://github.com/mozilla/r2d2b2g/issues/758

Discussions over there please.
(Reporter)

Updated

5 years ago
Blocks: 900232
So this is mostly already there in the nightly B2G: https://developer.mozilla.org/en-US/Firefox_OS/Using_the_B2G_desktop_client#option-runapp. That's a really nice app that you can just download separately and use.

The biggest missing piece is that ability to install an app. Once we get the app installed, we can simply manually invoke that app and pass it the argument to launch the app on startup. All of those mechanics are already in place!

Unfortunately, it looks like all the logic for talking to the simulator and installing the app is wrapped up in addon code. I'm not sure what the best way to approach this is yet, but I'll discuss it more with the devtools guys and go from there. We may just have to write our own code that is similar to the app-manager code that interfaces with the simulator, but for our needs it should be pretty simple.
Firefox communicates with the Simulator/B2G via the Remote Debugger Protocol (RDP), and your command-line tool should be able to do the same.

@harth wrote the fxconsole <https://github.com/harthur/fxconsole> tool, and I think it uses the RDP to communicate with Firefox/B2G processes, so you should be able to use its code (if your tool is written in Node) or at least use it as inspiration.
Thank Myk. I solved it after some digging around today; what I really needed was https://github.com/harthur/firefox-client. With that I was able to make my own client to do whatever I want, which is awesome. I should be able to figure out how to install an app with that and then run it, without much work. Seems like this won't be too hard after all, though there is still a ways to go and I might hit unforeseen problems.
I've made good progress with this. If you download the nightly B2G build, you can open it as an app and turn on remote debugging, then just write some rather simple node.js code to send JSON to the debugger. I've been able to list installed apps and open apps with that. The next step is to write to code to install an app, which I can probably just copy from the app manager. It's not too complicated, but you have to zip up the app and do a few other things.

The only issue is I'm not sure how to manage the B2G build. It doesn't feel right to tell people to download nightlies, but I don't think they publish actual versioned apps of B2G. This is the only build: http://ftp.mozilla.org/pub/mozilla.org/b2g/nightly/latest-mozilla-central/

Comment 5

5 years ago
mozilla-download npm package could be useful to automate the download and unpack of a b2g build:

https://github.com/mozilla-b2g/mozilla-download
(Reporter)

Comment 6

2 years ago
Not relevant anymore.
Status: NEW → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.