Settings

Theme

Show HN: Node-android – Run Node.js on Android

github.com

70 points by sequoiar6868 8 years ago · 28 comments

Reader

unit91 8 years ago

Serious question: what sorts of things would a person do with this?

Not throwing rocks, this is a question based in my own ignorance. I know what Node is, but I don't use it and I'm not an Android dev. Thanks!

  • m_mueller 8 years ago

    What I’d do is running a full blown database application on the device. Couchbase Lite can do that as an example - replicate to a Couchbase server and allow offline access to data and indices. If your server part is Node.js based you should be able to have the whole thing running offline on devices.

    Why? I’m Swiss. We drive a lot of trains and they enter a lot of tunnels. Or on the plane. Or on a mountain. Imagine you can just keep on editing all your business data and sync the delta once you get a connection.

    • fareesh 8 years ago

      In the past I've used PouchDB inside a webview for this use-case.

    • jayd16 8 years ago

      This is pretty much what Firebase is. https://firebase.google.com/docs/database/

    • stephengillie 8 years ago

      You may be interested in a new way to develop web applications that I have been developing. An entire site is represented in JSON, and pages are built by Javascript in the browser. This greatly reduces server calls, making it much faster as well as largely working offline.

      The site is in late alpha: https://www.sparational.com/

      (If you goto the Login screen and enter an unused username and password, it will create an account for you.)

      • thomasfoster96 8 years ago

        What makes this a better approach than having something like React run in a ServiceWorker?

        www.sparational.com seems to have gone down since I started writing this comment, but when I clicked on the link, it seemed to have quite a considerable wait until anything appeared on the screen.

      • tazard 8 years ago

        On my phone, it just says application error

        • stephengillie 8 years ago

          Which browser? I've tested on desktop Chrome, mobile Chrome, and mobile Firefox.

          IE and Edge aren't currently supported, and might never be.

          • tazard 8 years ago

            I tried Firefox Focus, Firefox Mobile, and Chrome. Just tested again and it's working now though. Looks interesting!

  • meiraleal 8 years ago

    I don't know about others, but developing react native apps I sometimes have the necessity to use some NPM modules that can't be used directly into react native. For example, I'm developing a 1-person chatbot platform and I want to run botkit processes inside the app so I don't need a backend. It can't be done with React Native but could be done using node-android or nodejs-mobile.

  • 8note 8 years ago

    I was working on making a reddit auto repost detector bot based on opencv that I was going to leave running on an old phone.

    I got node running on it without this though, but funemployment ended before getting the proper drivers running on it

mikece 8 years ago

If the purpose is to just run JavaScript code on Android outside of a browser context, React Native and NativeScript have been doing this for a while.

If the purpose is to run JavaScript functions as background services this is somewhat implemented via Service Workers in Progressive Web Apps.

I don't think there is any way (currently) to register a JavaScript function/library as an always-on server process. I don't see why this would be unsafe or particularly undesirable unless there is something computationally intensive happening.

lai 8 years ago

This is cool, but Termux gives you this and more.

rhacker 8 years ago

This looks like a NodeJS implementation written in Java (I'm guessing from a dead-push to make Java's JS VM capable of running NodeJS APIs - and note that its compatible with Node 0.10.x - very oldish) Still would likely fill a niche where previously not possible.

andrewguenther 8 years ago

"Run Node.js on Android by rewrite Node.js in Java"

It also hasn't been meaningfully updated in two years. I don't think that this is really useable.

antoniuschan99 8 years ago

I was able to get Node running on both Android and iOS using this library: https://github.com/janeasystems/nodejs-mobile

Here's the writeup:

https://medium.com/@tuffluver/control-an-industrial-robot-wi...

jimpick 8 years ago

Very nice! I've been playing with https://github.com/janeasystems/nodejs-mobile to get the Dat project to run on Android and iOS. This might be another way to do the same thing on Android!

  • Hydraulix989 8 years ago

    Your linked project makes a lot more sense since it is a native NDK port instead of a complete rewrite/re-implementation in another programming language.

hyperpallium 8 years ago

termux (on android) has nodejs

  $ apt search nodejs
  nodejs/stable 8.11.2 arm
    Platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications
disclaimer: I haven't used it
bitwize 8 years ago

Great hack, but what does it give me that Node under Termux doesn't?

  • z3t4 8 years ago

    You could probably packages a Node.JS app with this and release it as an Android app. I think this project need some examples.

JosephRedfern 8 years ago

I'm probably being blind here, but why would you need to re-write node.js in Java in order to be able to run it under Android? Why couldn't this be achieved through JNI (or similar)?

naoru 8 years ago

I used an old Android phone with Linux Deploy to run Node with MongoDB around 3 years ago. Now Termux allows to do basically the same.

sequoiar6868OP 8 years ago

the initial purpose is to run http over udp with nodejs on Android for p2p web service. I have spent years of effort on it, but I feel tired now. anyone interested in it, can fork and continue on it. thanks.

EGreg 8 years ago

Do we have one for iOS?

I would like to run my own web servers in Cordova!!

augbog 8 years ago

Why link to a fork?

philliphaydon 8 years ago

Now we just need android phones with 32gb of ram.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection