Bulk configuring with a script
- Dominant language
- Python
- Stars
- 58
- Forks
- 160
- Avg merge
- 5d 11h
- Merged PRs (30d)
- 12
Description
If you have to configure 10,000 phones offline, anything you can do to speed up the process of resetting the app and installing everything that's needed is a huge win. The way I've done this in the past is, at a high level...
1. Enable USB debugging. Note that how to do this varies for Android <2 and Android >3. We should document (or point to both).
1. Install Universal Android USB driver. This is particularly painful because Windows drivers for Android are particularly hard to find and don't always work. The link below has worked for me in the past.
* https://devs-lab.com/usb-adb-drivers-for-all-android-devices.html
1. Install minimal ADB. I like this adb because it's not the full Android developer tools. It's a small and fast download, which is great for people in the field.
* https://devs-lab.com/download-minimal-adb-fastboot-tool.html
Then you have a folder with the various files you need (e.g., a collect.settings file, form XML, an APK, etc, then you have a batch script in that same folder that you can double click. The script pauses at the end to give you a change to unplug the device and plug in another one.
```bat
@echo off
:start
cls
pause
C:/adb/adb.exe uninstall org.odk.collect.android
C:/adb/adb.exe shell rm -r "/sdcard/odk/"
C:/adb/adb.exe push "%cd%/collect.settings" /sdcard/odk/collect.settings
C:/adb/adb.exe push "%cd%/poi.xml" /sdcard/odk/forms/poi.xml
C:/adb/adb.exe push "%cd%/itemsets.csv" /sdcard/odk/forms/poi-media/itemsets.csv
C:/adb/adb.exe install "%cd%/ODK_Collect.apk"
pause
goto start
```
If you are on macOS or Linux, something like this might be better.
```sh
#!/bin/bash
adb uninstall org.odk.collect.android
adb shell "rm -r /sdcard/odk/";
adb push collect.settings /sdcard/odk/collect.settings;
adb push poi.xml /sdcard/odk/forms/poi.xml;
adb push itemsets.csv /sdcard/odk/forms/poi-media/itemsets.csv;
adb install ODK_Collect.apk;
```
It's been a while since I used these scripts, so it'd be good if this approach was tested, especially on Windows, and documented. I'd also welcome improvements (e.g., maybe the script should have a flag for destructive behavior like removing the odk folder)
Contributor guide
Research direction
Start with the Windows batch script and Bash example in the issue, then verify the listed ADB reset, file-copy, and installation steps on the relevant platforms. Done means documenting a tested offline bulk-configuration workflow, including Android USB-debugging guidance and any safe handling for destructive removal of the ODK folder.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, bash
- Domain
- documentation, mobile-dev
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100