Popularity
4.6
Stable
Activity
2.4
-
621
37
66

Description

Run Node.js on Android by rewrite Node.js in Java with the compatible API.

third-party: libuvpp, libuv-java JNI code by Oracle.

Code Quality Rank: L1
Programming language: Java
License: GNU General Public License v3.0 or later
Tags: Nodejs     HTTP    
Latest version: v1.0.13

node-android alternatives and similar modules

Based on the "HTTP" category.
Alternatively, view node-android alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of node-android or a related project?

Add another 'HTTP' Module

README

node-android

Android CI

Run Node.js on Android by rewrite Node.js in Java with the compatible API.

third-party: libuvpp, libuv-java JNI code by Oracle.

Build

Clone the code, open Android Studio (1.*) and import the project.

For Eclipse ADT user, refer to ADT branch

Javascript code injection

> adb shell am start -a android.intent.action.VIEW -n com.iwebpp.nodeandroid/.MainActivity -e js "var run = function () { return 'hello world'; } run();"

Features

JS runtime

  • Rhino supported
  • Exposed node-android packages: com.iwebpp.node.http, com.iwebpp.node.stream, com.iwebpp.node.net, etc
  • Exposed node-android classes: com.iwebpp.node.EventEmitter2, com.iwebpp.node.Dns, com.iwebpp.node.Url, etc
  • Exposed node-android native context in JS standard scope as NodeCurrentContext alias NCC
  • Exposed Android API: android.util.Log
  • NodeJS compatible internal modules are available in JS standard scope
  • Exposed WebSocket classes: com.iwebpp.wspp.WebSocket, com.iwebpp.wspp.WebSocketServer

JS usage

  • In case Rhino, create class 'MyScript' extends from com.iwebpp.node.js.rhino.Host
  • Implement 'public String content()' in 'MyScript' to return user script
  • Execute JS engine in a separate Java Thread with 'MyScript.execute()'
  • When authoring script, please use NodeCurrentContext(alias NCC) in node-android API
  • JS API usages details

TODO

  • API doc, more demos
  • JS runtime CommonJS/AMD compliance

Support us

  • Welcome contributing on document, codes, tests and issues

License

(see LICENSE file)

Copyright (c) 2014-present Tom Zhou([email protected])


*Note that all licence references and agreements mentioned in the node-android README section above are relevant to that project's source code only.