PhoneDo is an Android automation application that provides a scripting environment based on JavaScript with methods for handling native Android actions in a headless way.
The tech stack for this application :
Technology | Usage |
---|---|
Vue | Front end |
SQLite | For script storage CRUD operations. |
Bootstrap | For styling (in the context of script evaluation) |
JQConsole | For a terminal UI. |
JQuery | For manipulation of the DOM, also serving as a dependency for JQConsole. |
ACE.js | For an integrated scripting development environment (Users' reading and writing code inside of the app). |
I aimed to provide a straightforward way to script tasks, using scripts labeled with the .nts extension. Users can create these scripts and execute at their convenience. These scripts are stored on their device in a SQLite database and can contain JavaScript code that integrates with Android's native functionalities like file handling, text-to-speech, speech recognition, texting (SMS), Bluetooth connections, Wi-Fi, NFC, infrared, networking, SIM card operations, flashlight control, and battery management, among other things. I documented these methods here.
This project was inspired by this question on reddit Quoted from OP :
Is there a Lisp environment for Android that would let me make simple programs to e.g. hit a web API, parse JSON and display the results as text? I'd really like to open an app which shows me a list of all the little scripts I've made, I tap "Weather San Francisco" and see the text output of my program, done. I swear I saw something like this about a decade ago...
An example of how a user can control a device's flashlight would be to navigate to Script Editor
> File
> New Script
, then name the script, for instance, FlashControl.nts
On clicking OK, the script is created inside an ACE integrated development environment and a header is automatically generated, to allow you to provide additional details for the script.
/*
* Script Name : FlashControl.nts
* Date : Mon Aug 07 2023 04:49:00 GMT+0300 (East Africa Time)
* PhoneDo Version : 1.3.2
* Description :
* Author :
* License :
*/
Then, we can use a provided flashlight method to programmatically control it:
if (await flashlight.switchOn()) {
console.log(' Flashlight successfully turned on.');
} else {
console.warn(' Failed to turn on the flashlight.');
}
exit();
Expand the full script
/*
* Script Name : FlashControl.nts
* Date : Mon Aug 07 2023 04:49:00 GMT+0300 (East Africa Time)
* PhoneDo Version : 1.3.2
* Description : Turns on the flashlight.
* Author : PhoneDo
* License : None
*/
if (await flashlight.switchOn()) {
console.log(' Flashlight successfully turned on.');
} else {
console.warn(' Failed to turn on the flashlight.');
}
exit();
Congrats! You just made your first PhoneDo Script! Now let's figure out how to execute it.
To simply execute FlashControl.nts
, we navigate Run
> Run Script
and press Enter , or we can also manually navigate back at the PhoneDo terminal view and type in the following command line and press Enter :
run -i "Flashlight.nts"
OutPut on success :
Flashlight successfully turned on.
You may need to permit installations from unknown sources. To do this, navigate to your device's settings :
Settings > Security (or Settings > Apps > Security)
and activate the "Unknown Sources" option.
-
Download:
- Download and Extract the latest release to your desired path.
-
Install the APK:
-
Open a terminal or command prompt and run the following commands:
:: Install the APK file adb install -r "basePath/PhoneDo.apk"
-
-
Restore Sampled Demo Scripts (Optional)
- To make the sampled scripts available for experimenting with, run the following command to restore a prepared adb backup file:
adb restore "basePath/PhoneDoExamples.ab"
- To make the sampled scripts available for experimenting with, run the following command to restore a prepared adb backup file:
-
Allow All App Permissions (Optional)
If you want an uninterrupted experience, you can pregrant all of the wanted permissions, even though a script can request any of them at runtime.
-
At your device's Settings, navigate to "Apps" or "Application Manager," depending on your device.
-
Find and select PhoneDo from the list of installed apps.
-
Look for the Permissions or App Permissions section.
-
Enable or grant all the permissions listed under PhoneDo.
-
PhoneDo features an interactive Terminal User Interface with purpose-built commands designed to help you script easily.
Typing a command with no parameters dumps its help information.
Command | Description |
---|---|
slist | Script management utility. |
run | Runs a script. |
beep | Plays a beep sound for an audible audio feedback. |
ipconfig | Retrieves the IP address information for the active connection. |
ifconfig | Retrieves the IP address information for the active connection. |
cls | Clears the terminal screen. |
clear | Clears the terminal screen. |
exit | Quits the current terminal instance. |
time | Prints the system time information to the standard output. |
sysinfo | Displays information about a device software configurations. |
ping | Sends ICMP ECHO_REQUEST to network hosts. |
API | Implementation | |
---|---|---|
bluetooth | In Progress.. | |
>1.3.2 | wifi | community-cordova-plugin-wifi-wizard |
>1.3.2 | sim | community-cordova-plugin-wifi-wizard |
>1.3.2 | utter (Speech synthesis : TTS/STT) |
cordova-plugin-speechrecognition , cordova-plugin-tts-advanced |
>1.3.2 | network | cordova-plugin-advanced-http , cordova-plugin-network-information , cordova-plugin-networkinterface |
>1.3.2 | device | cordova-plugin-device |
>1.3.2 | flashlight | community-cordova-plugin-flashlight |
>1.3.2 | sim | community-cordova-plugin-sim |
>1.3.2 | fs (file system) | cordova-plugin-file |
>1.3.2 | ️️️browser |
Your assistance is much appreciated. There are various ways you can help make the project better :
If you're a dev, you can contribute by:
-
Filing Issues: Report bugs or suggest new features by opening an issue.
-
Pull Requests: Implement new features or fix existing issues by submitting a pull request.
Contribute by:
- Updating Docs: If you notice any gaps or errors in the documentation, feel free to submit a pull request with your improvements.
Help improve the overall user experience by:
- Design Contributions: If you have design skills, propose UI/UX enhancements to make PhoneDo more user-friendly.
Contribute to the stability of thia app by:
-
Testing: Try out new features and report any issues you encounter.
-
Bug Reports: Provide detailed bug reports, including steps to reproduce and information about your environment.
Contribute to the PhoneDo community by:
- Answering Questions: Help fellow users by answering questions on forums.
Checkout our Community Group before making substantial contributions to connect with other contributors and get a sense of ongoing discussions.
PhoneDo Logo : https://linktr.ee/namishkashyap