If you want to run javascript app like anyother app in your android device, you can follow this steps.
-
Install Termux in your device using f-droid
-
In termux install git using
pkg install git -
In termux write
git clone https://github.com/sk-Prime/webappif you don't want to use git, just go to this This git link and download as zip and extract to your desired folder. -
In Termux, write
cd webapp -
Then
mv webapp your-desired-location -
If you don't have python installed in termux use
pkg install pythonto install it. [in fututre TM I will remove this dependency]
The webapp directory looks like this
├── apps
│ ├── Base Quiz
│ │ ├── Base Quiz.html
│ │ ├── Base Quiz.svg
│ │ └── baseui.js
│ └── resistor
│ ├── resistor.html
│ ├── resistor.js
│ ├── resistor.svg
├── index.html
├── script.js
├── styles.css
└── webapp.py
-
appsis the directory where you need to put your app folder which contains javascript and html files.webapp.pyassumes the folder name as the app name. And inside the folder the main page and icon [if you want to show a icon] name must need to be same as folder name. You can modifywebapp.pyto change its behavior. -
index.htmlis the page where all the apps in theappsfolder will be shown. So download a browser from play store. set thisindex.htmlas the homepage of that browser. -
webapp.pyis the main program which will modifyindex.htmlto add apps in it. I will make a binary file soon TM. so python will not require. -
Everything is done. Simply put your javascript app in
appsfolder and runpython webapp.pyand then open the browser which is previously configured.
To make that final step automatic. You can put a webapp.sh in termux .shortcuts folder. (You may need to install termux:widget app). Then you will see webapp.sh in termux widget. Inside webapp.shwrite down this
cd $HOME/storage/shared/myfolder/web/webapp/
python webapp.py
am start --user 0 -n your-browser-activity-name
CD to your webapp directory where webapp.py is located. I am using via browser so the activity name is mark.via.gp/mark.via.Shell . You can check your broswer's activity name using any activity monitor program.
This program does not require any background server. You can not set any cookie to save app state and you can not access local files and folder from app.
TODO: Codes need to be polished and need to make more user friendly.