To run cross-compiled NFD binary on rooted Android device, there are several steps:
- A rooted Android device. (It has to be rooted or no one can run binaries copied to sdcard from command line. It is possible to use an Android application wrapper to carry and run native binaries on unrooted device. I have not test that yet since we need to do debugging on command line and wrapper is just too complicated for debugging.)
- Get cross-compiled NFD binary
- Get Android SDK. (I use adb
"shell"to open up a shell to run NFD)
- Enable development mode on the Android device.
Steps to run NFD on rooted Android devices:
Copy binaries and configuration file to sdcard of the phone. To do this, you can:
"adb push"command; or
b. Use other applications like "Android File Transfer" on OS X.
On terminal, type
"adb shell"to get a shell on Android phone.
Copy binary from sdcard to
/data/local/tmp. (You must use
mvwon't work for this case.)
"chmod 700"on all binaries to make them executable. (syntax like
"u+x"won't work on Android.)
Modify nfd.conf and comment out websocket section and unix socket section.
Run nfd binary with environment variable
HOMEpointing to a writable place. For example
"HOME=/data/local/tmp ./nfd --config ./nfd.conf"