Developing with Moto X

android, mobile, Moto X, programming

Just recently upgraded from an Android 2.1 device (HTC Aria) to an Android 4.4 device (Moto X).

To enable the developer USB feature that allows installing and running (let alone debugging) programs, two things need to be done:

  • Install the Motorola USB drivers (https://motorola-global-portal.custhelp.com/app/answers/detail/a_id/88481/action/auth)
  • Enable the Developer feature on the phone:
    • Go to Settings
    • Scroll to the “About phone” option under the “SYSTEM” section and click the option 7 times (after clicking it 3-4 times you should see a message saying something like “you are X steps away from being a developer”)
    • After clicking it 7 times, you will “become a developer” and will then see a “{ } Developer options” entry under the “SYSTEM” section where you will be presented with a LOT more settings.

 

Mobile-enabling a Web page

android, mobile, programming

Stop that condensation

By default, my mobile Web browser attempts to make everything smaller so that a “normal” web page will fit in the phone’s screen, even when the page has a few items that would fit in the mobile browser’s native resolution.

One way I found (that this WordPress page is doing) to prevent that over-eager condensation of the page is adding a meta tag:

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />

See the viewport page from Apple.

adb useful commands

android, programming

List devices (including emulations)

> adb devices
List of devices attached
emulator-5554   device

List directories via shell (emulation)

> adb -e shell ls -l
dr-x------ root     root              2013-03-03 22:28 config
drwxrwx--- system   cache             2012-01-18 01:10 cache
lrwxrwxrwx root     root              2013-03-03 22:28 sdcard -> /mnt/sdcard
drwxr-xr-x root     root              2013-03-03 22:28 acct
drwxrwxr-x root     system            2013-03-03 22:28 mnt
lrwxrwxrwx root     root              2013-03-03 22:28 d -> /sys/kernel/debug
lrwxrwxrwx root     root              2013-03-03 22:28 etc -> /system/etc
drwxr-xr-x root     root              2010-06-30 14:06 system
drwxr-xr-x root     root              1969-12-31 16:00 sys
drwxr-x--- root     root              1969-12-31 16:00 sbin
dr-xr-xr-x root     root              1969-12-31 16:00 proc
-rwxr-x--- root     root        12995 1969-12-31 16:00 init.rc
-rwxr-x--- root     root         1677 1969-12-31 16:00 init.goldfish.rc
-rwxr-x--- root     root       107412 1969-12-31 16:00 init
-rw-r--r-- root     root          118 1969-12-31 16:00 default.prop
drwxrwx--x system   system            2012-04-14 17:45 data
drwx------ root     root              2010-01-27 16:59 root
drwxr-xr-x root     root              2013-03-03 22:28 dev

Copy files from device/emulation

> adb -e pull /data/data/org.van/databases/notables.db c:temp
17 KB/s (4096 bytes in 0.231s)

Note the location of databases (Sqlite3):

/data/data/<package name>/database/

More

ADB page