Android Application development
Contents |
Android Application development with Snowball
For general documentation about Android development, please refer to the Android developer guide.
In a nutshell, after getting the ADB connection working you can install you application with:
$ adb install -r app.apk
watch the log output (for messages related to crashes etc) with:
$ adb logcat
and gain a shell or run a command on the device with:
$ adb shell [command]
ADB enables many other debugging methods as well, please refer to the debugging section of Android Developer guide for details.
Android Debug Bridge (ADB)
To push the developed applications onto the device, and to debug your applications, you need to set up the Android Debug Bridge (ADB). ADB is available from the Android SDK. Make sure you use an SDK target matching the Android version running on the Snowball when building your applications.
There are two modes that ADB can operate in, over the USB connection or over the network.
Setting up ADB over USB
For ADB over USB you need to ensure two things:
- The file .android/adb_usb.ini on your host machine home directory (eg. /home/keke) should contain the string “0x4CC” and nothing else
- This is the vendor identification code for the board
- The user that the ADB server is running with needs to have proper permissions to the USB device
- The Android developer guide has a description how to set up the permissions
- Though it is not recommended for security reasons, you can also run the ADB server as root to gain the permissions:
$ adb kill-server $ sudo <path-to-sdk-platform-tools>/adb start-server
The Android is by default in the ADB over network mode, so you must first disable the tcpip mode for adbd on device from the serial console:
$ setprop service.adb.tcp.port "" $ stop adbd $ start adbd
For ADB over USB operation, connect the board to a host machine with a mini-B USB cable to the OTG port. You should see a debugging icon on the status bar to indicate that the connection is established after connecting the cable.
NOTE: Since there is only one USB port, you will not be able to use USB devices (such as mice and keyboard) while using ADB over USB
To circumvent this limitation, you can use the ADB over network as described below.
Setting up ADB over network
The Android is by default in the ADB over network mode, but if you have switched to usb mode you must first enable the tcpip mode for adbd on device from the serial console:
$ setprop service.adb.tcp.port 5555 $ stop adbd $ start adbd
Make sure the network cable is connected or that the wifi connection is up and that the device has obtained an IP address with the netcfg command.
On host side, make sure that ADB is running in tcpip (network) mode with:
$ adb kill-server $ adb tcpip
After this you should be able to connect to the device with:
$ adb connect <IP address of device>
USB Device Mode -- Connecting snowball to a PC
As its not possible to access the Android UI using a USB mouse when the snowball is connected to the PC over USB the below command line option is provided to enable USB device features.
Mass Storage -- To Access SD card plugged into snowball in the PC
Mass storage is enabled by default
- On Android console run and check for "mass_storage"
getprop sys.usb.config
- On Android console run
echo /dev/block/<Insert partition here> > /sys/devices/soc0/musb-ux500.0/musb-hdrc/gadget/lun0/file
- For ex:- if you are booting from emmc then
echo /dev/block/mmcblk1p1 > /sys/devices/soc0/musb-ux500.0/musb-hdrc/gadget/lun0/file
- if you are booting from SDcard then give the appropriate partition that you want to access in the pc
- Plugin USB cable to PC
Tethering over RNDIS
- On Android console run
setprop sys.usb.config rndis,adb
- Plugin USB cable
- On Android console run
ifconfig rndis0 up && dhcpcd rndis0 OR ifconfig rndis0 192.168.42.5 up
- On Android console run "netcfg" to find out the ip address assigned to rndis0
- On PC run
ifconfig usb0 up && dhcpcd usb0 OR ifconfig usb0 192.168.42.121 up
- Run "ifconfig -a" to find out ip address assigned to usb0
Ping between host PC and device should work now.
ACM (serial/COM port over USB)
- On Android console run
setprop sys.usb.config acm,adb
- Plugin USB cable
- In device use "/dev/ttyGS0"
- On the PC use "/dev/ttyACM0"
MTP -- Enabled but not fully functional
If you need a particular configuration to be remembered over successive reboots then on the android console give
setprop persist.sys.usb.config <configuration>
Supported configurations (present in init.usb.rc and init.st-ericssonsnowballplatform.usb.rc:
- mass_storage,adb
- mass_storage
- rndis,adb
- rndis
- acm,adb
- acm

