-
-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to android build? #68
Comments
Interesting idea, thanks for the suggestion! If we were able to build for Android, then the program would be able to run on Chromebooks too through the Google Play Store. What do you think @ethanaobrien? We can build a lightweight web based UI for the app using Cordova, which I am very familiar with. We would have to figure out how to best run a web server in the background on Android, and how to port over the logic for it. |
It'd be pretty cool, we'd probably only need to re-write the base handler, everything else should theoretically plug in (assuming we can still use the nodejs libraries) |
@ethanaobrien I recently tried building the app using Tauri instead of Electron. The UI works great because Tauri uses a web view, but the actual server backend doesn't work because Tauri uses a Rust backend, not Node like Electron does. The advantage to using Rust is that it cuts memory usage in half. Together with using a system web view instead of shipping with Chromium, Tauri app installers can be as small as 3 MB! They launch faster too. The reason I bring this up is because I understand that Android supports Rust also. So, in theory, if we rewrote the web server code into Rust, we could achieve significantly smaller app size, smaller memory usage, and faster launch time on Windows/macOS, and then we could also port it all over to an Android app which could run on Chrome OS. Tauri also say they plan to add support for compiling for Android and iOS in the future, because it doesn't support it yet, but we can use Cordova in the meantime. I don't know of any practical way that we could use the Nodejs code and libraries in an Android app. Nodejs and Electron in general probably isn't the ideal choice for an app like this one, which is a sentiment that I believe kzahel expressed. I think Tauri and Rust could be a better long term choice. Please let me know your thoughts on this. Do you think converting the web server logic into Rust would be a good idea, and would it be something you'd be interested in doing? Of course, we can still launch the first version with Electron and then consider a transition later. |
I think it'd be cool to do, and efficient, I just don't know rust so thatd be a setback |
I don't know Rust either. I've been playing around with it, and my initial impressions are that it's somewhere in-between C and a language called SML. I had a go at converting humanFileSize into Rust. Here's what it looks like: fn main() {
println!("{}", humanFileSize(340850.0));
}
fn humanFileSize(mut bytes: f32) -> String {
let thresh = 1024.0;
if bytes.abs() < thresh {
return format!("{} B", bytes);
}
let units = ["KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"];
let mut u = -1 as i32;
loop {
bytes /= thresh;
u += 1;
if !((bytes.abs() * 10.0).floor() / 10.0 >= thresh && u < (units.len() as i32) - 1) { break; }
}
return format!("{} {}", bytes, units[u as usize]);
} Obviously there's a learning curve, but it wasn't too difficult to figure out the Rust syntax. I don't think converting the existing logic code into Rust is going to be very difficult. I think the challenging part will be figuring out how to actually create a web server and file system in Rust, although I'm sure that both of these things have already been done and there might be libraries we could use. Do you have interest and time to learn Rust? |
Hi, do you think this can help - Do you think node js api can be communicate as below -
|
@WebScaffolder Thanks for the idea! I believe this might work, however it would greatly increase the app size (from around 5 MB to around 100 MB), and it would run in the JavaScript context which would be problematic for running in the background. I think if we instead ran the web server from the native side, it would be able to run in the background without the UI needing to be loaded. |
Time would be a crunch especially with school and yeah. Once we find a library for http sockets and the filesystem I'd sit down to learn rust. I've been really busy lately so sorry if I havent been as active. |
No worries. I will keep looking in to Tauri and Rust. |
Meanwhile can we build with cordova, i think just need to lunch app using cordova but need to figure out nodejs in background so that codova can start node js server from config. require('electron') should be remove for app. let me know. |
I'm having difficulty understanding what you said. I have no immediate plans to build an Android version of this program using Cordova, but it may be something we pursue in the future. |
Hi, Cordova is not necessary but do you think we can use app, BrowserWindow from electron, lets say I can install Termux - node environment and run index.js..do you think electron's app method work here? There can be a simple solution, lets fix it. |
Electron does not support mobile. Also, any solution that would involve the user needing to download Termux cannot be considered simple. There are existing web server apps on the Google Play store, and while none of them have functionality that aligns with the features of Simple Web Server, I'm sure one of them would work in the meantime. That said, I still would like to bring this app to mobile, but I'll need to keep looking in to the best way to make that happen. |
Hi, Please check below - I can able to run index.js after removing electron using https://play.google.com/store/apps/details?id=io.tempage.dorynode&hl=en but it's not open source though. Rust u may use for memory facility and all but java project Android-NodeJS-Frontend can be customize for this project which can save time. remember neither rust or cordova can give you node environment as built in way. Let me know your thought. |
The only thing the app needs Node for right now is the web server, which shouldn't be running from the frontend. I don't think finding a way to use Nodejs on Android is going to be an effective approach, for app size and memory usage reasons.
Rust can't provide a node environment, that's true, but the goal is to not use a node environment in the first place. I have no doubt that it's possible to port the existing code to Android using Nodejs, but at the moment I am looking to find a better and more efficient way to achieve the same result. I don't currently have plans to use node in any capacity in a mobile environment. |
@terreng |
open source - non commercial - As I said UI is ready, just need to connect WSC with it and we can build for Windows with ant and gradle for android. |
And same time think about IOS as well - win, android, ios compitability neceessary for completing this project i hope. |
Hi,
Thanks for that. I would let you know my thoughts soon later by asking one question -
Can we not develop whole project using Cordova 7 ? - which have all platform build support now.
Cordova Windows 7.0.0 Released! - Apache Cordova
|
|
| |
Cordova Windows 7.0.0 Released! - Apache Cordova
We are happy to announce that we have just released Cordova Windows 7.0.0! This is one of Cordova's supported p...
|
|
|
Jamial Hasan
On Monday, 21 February 2022, 17:27:51 GMT, Terren ***@***.***> wrote:
@ethanaobrien I recently tried building the app using Tauri instead of Electron. The UI works great because Tauri uses a web view, but the actual server backend doesn't work because Tauri uses a Rust backend, not Node like Electron does. The advantage to using Rust is that it cuts memory usage in half. Together with using a system web view instead of shipping with Chromium, Tauri app installers can be as small as 3 MB! They launch faster too.
The reason I bring this up is because I understand that Android supports Rust also. So, in theory, if we rewrote the web server code into Rust, we could achieve significantly smaller app size, smaller memory usage, and faster launch time on Windows/macOS, and then we could also port it all over to an Android app which could run on Chrome OS. Tauri also say they plan to add support for compiling for Android and iOS in the future, because it doesn't support it yet, but we can use Cordova in the meantime.
I don't know of any practical way that we could use the Nodejs code and libraries in an Android app. Nodejs and Electron in general probably isn't the ideal choice for an app like this one, which is a sentiment that I believe kzahel expressed. I think Tauri and Rust could be a better long term choice.
Please let me know your thoughts on this. Do you think converting the web server logic into Rust would be a good idea, and would it be something you'd be interested in doing? Of course, we can still launch the first version with Electron and then consider a transition later.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
I am very familiar with Cordova. Unfortunately it doesn't solve the issue here. Simple Web Server is made up of two parts: the web-based user interface, and the web server code. Cordova would make it easy to run the user interface on Android or iOS, but it that's only half of the app. The other half, the actual web server code, currently runs with Node.js, and can't be ported as easily. |
Hi, is it possible for android apk build and act as an android localhost Web server?
The text was updated successfully, but these errors were encountered: