Execution on Android
- Install Termux from F-Droid - Android terminal emulator and Linux environment.
- Install Termux API from F-Droid - This addon exposes device functionality as API to command line programs in Termux
-
Open Termux and update:
pkg update && pkg upgrade
-
Install required packages with
pkg install python git termux-api
-
Clone the Collectu repository:
git clone https://github.com/core4x/collectu-core.git
-
Create an api access token. Save the created token in the root directory (
/collectu-core
).You can switch directories with
cd collectu-core
You can create a file with
touch api_access_token.txt
You can change the content of the file with
nano api_access_token.txt
-
Switch to the src directory with
cd src
Run the app:
python main.py
- Continue with our First Steps.
To stop Collectu click CTRL + C
To stop Termux CTRL + D
Access Android Sensors
You can access built-in smartphone sensors using Termux API.
To list all available sensors execute:
termux-sensor -l
To gather sensor values in Collectu, implement the user_logic module using the following code:
import subprocess
import json
sensor_data = subprocess.check_output(["termux-sensor", "-s", "Gravity Sensor", "-n", "1"])
data.fields = json.loads(sensor_data)[0]['values']
Docker
First Steps