SwarmMobile is a bee client built with fyne using bee-lite. It can run on multiple platforms supported by fyne.
To Build from source you will need fyne.
make get-fyneAlso necessary to install the android ndk and set the following environment variables. Then add them to the PATH environment variable.
export ANDROID_HOME=$HOME/Library/Android/Sdk
export ANDROID_NDK_HOME=$ANDROID_HOME/ndk/<specific-ndk-version>
export PATH=$ANDROID_HOME:$ANDROID_NDK_HOME:$PATHBy default the target is is android/arm64 and the app ID is com.solarpunk.swarmmobile. On macOS with M chip it TARGET_OS should be darwin To overwrite them set the following environment variables:
export APP_ID=com.solarpunk.swarmmobile
export TARGET_OS=darwinTo create a package:
make packageRecommended to use goenv as go version manager tool
To run without packaging on your local development environment:
go run main.goIf you wish to simulate a mobile application:
go run -tags mobile main.goAndroid has networking restrictions since API 30+ so to make libp2p work tweaks required on the Go repository that will be used to compile this code (or bee-lite ).
Based on the following github issues: dnsconfig_unix.go netlink_linux.go, interface_linux.go
-
Copy the _android files under the net/ and syscall/ subfolders of this repo to their respective folders under your go installation, e.g.:
cp ./net/* /Users/username/.goenv/versions/1.24.2/src/net/ cp ./syscall/* /Users/username/.goenv/versions/1.24.2/src/syscall/
-
Furthermore, add the following build directive to the existing dnsconfig_unix, interface_linux, netlink_linux files:
//go:build !androidor if a windows exclusion exists add android like
//go:build !windows && !android -
To make these changes effect you should recompile the go binaries from the modified sources above - with the newly added *_android files .
For this go to source folder root /Users/username/.goenv/versions/1.24.2/src/ for example. Search for make.bash and open it. Search for 'bootgo' in this file. That version is required to compile the target Go version. Install it and point GOROOT_BOOTSTRAP to that GOROOT like GOROOT_BOOTSTRAP=/Users/username/.goenv/versions/1.22.6 on Mac. After this run make.bash and it should compile the distro
By building the sources an .apk package is generated. It can be installed wiht a simple drag-and-drop on an Android device by connecting your computer via USB. Then just install the package by tapping on the installer (you might need to enable installing packages from unknown sources).
Then on your computer adb needs to be installed. Use the following script to start the adb service and listen for the logs coming from the app (it filters out the logs coming from the fyne framework and colors the lines):
DEVICE_ID=$(adb devices | awk 'FNR == 2 {print $1}')
echo "device ID: ${DEVICE_ID}"
#tail logs
adb -s ${DEVICE_ID} logcat -v color time Fyne:V "*:S"
# or into file
adb -s ${DEVICE_ID} logcat -v color time Fyne:V "*:S" > swarm_mobile.logTo be able to run the app in the browser set the following environment variable:
export GOPHERJS_GOROOT=<specific-go-path>/libexecThen run the command:
fyne serve -os wasmFor more information about the build options run:
fyne package --help- release for testnet and mainnet
- code review
- use latest bee-lite version
- fix networking on errors on Android
- host binaries for Android
- host binaries for IOS