Posts Tagged development

HOWTO :: Pull OTA upgrade file from Galaxy Nexus

Recently I’ve got Galaxy Nexus to play with, and as soon as I’ve entered Wi-Fi password, an OTA upgrade came my way. It was very tempting to upgrade immediately, but I’ve decided to pull upgrade file from the device to see what’s inside.

Unfortunately, the phone comes from the factory locked and there’s no way to access system files except unlocking the protection.

Regarding the root access

First we need the root access to be able to access files freely.

I don’t like to permanently root my phone, so I prefer the temporary method, which keeps the phone protected, but gives me the opportunity to access what I need if I really need it (I do not delve into details about how to use adb, hoping you already know that).

Unlock the phone

Reboot into fastboot mode by switching power off, and holding all three buttons (volume up/down and power) until Android logo appears. then issue ‘fastboot oem unlock’ command from your computer. This requires full memory wipe, so be careful and make a backup of any data you care to keep.

Download the superboot

Superboot is the bootoader image, which can turn the phone into a rooted one, but only until the next reboot. Handy and safe.

Reboot into superuser-enabled mode

While still in fastboot mode, the following command will restart the phone with the boot image we have just downloaded.

fastboot boot boot.superboot.img

Wait until the update comes

Since the phone was wiped clear during unlock, we have to wait again for upgrade to come, or request the upgrade check from Settings menu, if you are impatient.

Move upgrade file into the easy to access place

Since adb can not pull system files, we have to move the upgrade file somewhere we can access easily. I chose /sdcard folder for that purpose

adb shell
$ su
# cd /cache
# ls
[... file list skipped ...]
# mv signed-yakju-ICL53F-from-ITL41F.0927b42c.zip /sdcard/

In your case the file name most probably will be different, but it’s quite easy to tell based on size (90MB in my case), which file to copy.

Extract the file from the phone

Finally we can use adb to get the file:

adb pull /sdcard/signed-yakju-ICL53F-from-ITL41F.0927b42c.zip .

, , , ,

No Comments

Auto-Update-Apk :: Automatic Update Deployment for Android Applications

auto-update-apk logo

First, I had an application. And a customer. And another customer. Actually, a few people wanted to use the application, but due to a specific nature of the software it is not intended for Joe Public, and I’m quite reluctant to put it on the Market.

Then comes the problem: I can tell the customer to install the program from a given URL, but how do I deploy updates to the software? Unfortunately, Android Market does not provide update options for non-Market applications.

I’ve spent a few days looking for an automatic update deployment software on the net. Found a few. Most of them are just plain disappointments. So,I’ve decided to spend a weekend to roll my own. Maybe also a disappointment, but at least my own.

Finally, today I’ve published the first version of AutoUpdateAPK service. Due to gruesome death of the service I’ve used before, I was quite pressed for time, so the basic functionality is a bit limited, but is expected to grow rapidly. Especially, because we are going to use this service ourselves quite extensively.

Android code is open-sourced under Apache 2.0 license, so people may freely copy it into their applications and start to deploy updates automatically.

, ,

No Comments

Ainol NOVO7 :: Google Applications package for ICS 4.0.1

The official version of 4.0.1 software does not include google applications for some reason, so I had to search the internet and prepare the update package. The software, which requires binary libraries, is not included (TTS + Sound Recognition, Face Lock, Video Editor), also Google Earth is gone because it’s just too big.

Everything else is packed, signed and can be easily installed on native 4.0.1 without any rooting or CWM hackery. Just copy the file as update.zip to your microSD and press “volume+/power” to start the update process.

NOVO7B-GoogleApps-ICS-update-signed.zip (27MB)

MD5: 733c58b23db53ca9188888e8edc1f317

  • installs using native recovery
  • works with official ICS 4.0.1 version
  • requires about 13MB of empty space on /system (usually about 15M are free)
  • includes gmail, exchange, maps, latitude, news, talk, market, youtube, Latin IME
  • does not include Chinese IME, Earth, TTS + Sound Recognition, Face Lock, Video Editor
  • does not require CWM or rooting for installation

, , ,

No Comments

Mail/parcel tracker — now with Sagawa and Kuroneko Yamato support


Two other major delivery services are supported now by mail tracker: Sagawa Takkyubin (佐川宅急便) and Kuroneko (ヤマト運輸), but it’s still as simple as it was before — just enter the number and the program will automatically check and decide where and how to track it. Barcode scanner works now almost always, success rate is about 95% even in extreme lighting conditions. It takes only 2-5 seconds to scan a receipt and get all the tracking info available on the screen. If you send a lot of mail you know how troublesome and time consuming this might be.

Here’s version 0.9.7 (still beta, but improving quite fast and steady): 配送追跡.

, ,

No Comments

Japan Post mail/parcel tracker

Got some spare time and made a little application for Android, which helps to check the current status of my mail and packages right from my phone. Actually I’ve tried a few other similar applications first, but haven’t found the one which works just as I like. Most of them don’t support barcode scanning and don’t validate input, so I could input any garbage instead of tracking number (you know how error prone is touch-typing =) and then spend hours wondering why my parcel does not show up in the tracking list. Another thing I don’t like is to choose every time what kind of number I have, Expack or cash on delivery/registered mail — they all look very similar written on the paper.

My application (配送追跡) takes the number and selects the proper category automatically, also it calculates checksum for every number and rejects anything that fails validation. Took me a few hours to reverse engineer checksum calculation for Japan Post tracking numbers, but finally it works, and, by some strange coincidence, same validation scheme is used for Sagawa (佐川宅急便) and Kuroneko (ヤマト運輸) express delivery tracking numbers, so maybe I’ll add support for those in the future.

There are still a few kinks to iron out, and current barcode scanning library from “ZXing team” gave me mixed results on my phone, but people say it’s the best one and the actual problem is in my phone, so I hope it works well for you.

And, please, don’t worry about the kanji on the screenshot — the program will display everything in English if you phone has non-japanese locale set.

,

No Comments

Eclipse :: coding for Android back again

walking android

After a long while, I’ve recently started to code a few things for Android, launched Eclipse and was greeted with mysterious errors. Which include:

  • “layoutlib is too recent. update your tool” in the Eclipse layout editor. This was solved by upgrading android libs and SDK and also upgrading ADT from inside of Eclipse->Help->Upgrade. The former upgrade probably was not really necessary, but I did it anyway just in case to prevent other incompatibilities from coming out.
  • another gem appeared when I tried to create an empty project to test a few ideas: “error generating final archive: Debug certificate expired”. This required deleting ~/.android/debug.keystore and “cleaning” the project, which eventually led to regeneration of required debug keys. Google says debug keys are expired after 365 days, so it must have been more than 1 year since I’ve started playing with Android.
  • if you plan to access internet from the emulator, open Run->Configuration->Target and set “Additional Emulator Command Line Options” to “-dns-server 8.8.8.8,8.8.4.4″ and don’t forget to require INTERNET permission in the manifest.

And yes, I’ve got two walking plastic Androids to race them against each other around my table.

, ,

No Comments

HOWTO :: Archos 70 ddms/adb connection

It’s fun to play with Archos 70, but eventually comes the development time. Since Archos 70 is not officially supported by Google, “adb devices” gives empty list and “ddms” does not see it either.

1. First step is to find out the maker/model code.

$ lsusb
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 013: ID 0e79:1411 Archos, Inc.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

2. I thought “android update adb” will get the job done, but got no results here. Then I’ve just manually added the maker code to .android/adb_usb.ini file.

$ nano .android/adb_usb.ini
# ANDROID 3RD PARTY USB VENDOR ID LIST -- DO NOT EDIT.
# USE 'android update adb' TO GENERATE.
# 1 USB VENDOR ID PER LINE.
0x0E79

It’s a good idea to kill adb server at first. Then “adb devices” starts to see the tablet, but could not access it propely.

$ adb kill-server
$ adb devices
List of devices attached
???????????? no permissions

3. It’s time to assign proper permissions for the USB device

$ sudo nano /etc/udev/rules.d/53-android.rules
SUBSYSTEM=="usb", SYSFS{idVendor}=="0E79", MODE="0666"

Well, this time everything works just fine:

$ adb devices
List of devices attached
A70-6A920022-9FF80000-0160C5C6-14015009 device

And I could even snap a screen capture with “ddms”.

, ,

3 Comments

HOWTO :: repack and sign ROM image update .zip files

DISCLAIMER: I don’t invent anything new here, but just summarise things I’ve read across different forums and web sites. I did not write any software mentioned here, but only copy the files and made them available in one easy to access place. I use the procedure described here to create ROM images I flash to my HTC Desire phone, and so far it worked for me perfectly. However I do not guarantee it will work on your system with your files and your phone — use it at your own risk and assume all responsibility. REFLASHING YOUR PHONE MIGHT GET IT BRICKED AND MIGHT VOID YOUR WARRANTY.

Prerequisites

To be able to follow this explanation you will need the basic understanding of the command line, be able to enter commands with the parameters, to walk from one folder to another, to compile programs and to run the resulting binaries. To run Java programs you’ll need Java SE runtime installed. To compress and uncompress files you’ll need “zip” program or something similar.

Your phone should be rooted beforehand or allow the installation of custom ROMs.

The Outline

The process of creating your own ROM update file is not very complicated. Basically it consists of three steps:

  1. Download and unpack the image you like
  2. Make the necessary changes
  3. Pack and sign the .zip file

The update can contain as much as the full system + boot + radio + recovery + extras, which completely overwrites everything you have in your phone, or as little as single .apk file if you want to make just small changes.

Download and unpack

There are plenty of images available on the internet, it’s in your best interest to find the one as much similar to what you need to reduce the necessary changes and introduce as few problems as possible. There are three types of images you may use:

  1. RUU images (.exe)
  2. OTA images (.zip)
  3. 3rd party .zip images

RUU images contain full system, including radio, system, boot and the whole nine yards. However you’ll need to unpack .exe file into .zip file before doing anything useful. I have explanation how to extract the .zip file in Linux but if you use Windows or MacOS your procedure might be different.

OTA images usually contain only the difference between the previous software version and the current one. Therefore you’ll need the previous software as RUU/.zip file with the exact version, and be familiar with bspatch utilty to apply patches, which is quite tedious process. I don’t usually use OTA files if there are any other options available.

.zip images are the easiest to work with, just unpack with your zip archiver to the folder you like.

If you have started with RUU image, you’ll have system.img, boot.img and radio.img files. System image can be further unpacked with unyaffs (requires compilation) to another folder, usually “system/”. Boot image can be unpacked with the perl script (requires perl to be installed on your computer) also to another folder, usually “boot/”. Radio images cannot be unpacked and are better to be left alone.

Make the changes

Most of the changes are done to the system image, which contains all software and data files visible on the phone. Boot image should be changed only if you have deep linux knowledge to modify linux kernel and related matters.

If you have unpacked system image and made some changes, the system.img file is supposed to be moved somewhere else, so it’s not used anymore. Same with the boot.img file. All other files (hboot, recovery) are usually not used, because they might lead back to unrooting the phone and should be deleted or moved as well.

If you have based your work on RUU file, you’ll have to create META-INF folder with the correct information and update scripts inside. If you have unpacked someone’s .zip, the META-INF folder should be already present. Update script might mention some files in the update, so if you have removed (or added new) files, the update script should be amended to reflect those changes. Please, get a few images from different developers and try to understand the correct internal structure.

Pack and sign .zip file

Once you’ve made all the changes, you may change to the folder where you extracted all files, it might now contain .img files, like boot.img and radio.img as well as folders, like “system/”. Zip everything together with the command:

zip -r9 update.zip *

-r9 tells the program to collect files recursively and use the maximum compression. If you omit “r”, the subfolders will not be included (bad, bad idea!), if you omit “9″ nothing bad will happens, but resulting file might be about 1% larger.

To sign zipped file you should download SignApk.zip (requires Java), there are three files inside:

  • SignApk.jar is a tool included with the Android platform source bundle.
  • testkey.pk8 is the private key that is compatible with the rooted recovery image
  • testkey.x509.pem is the corresponding certificate/public key

and the signing command looks like this:

java -jar signapk.jar testkey.x509.pem testkey.pk8 [update.zip] [update-signed.zip]

update-signed.zip can be copied to the phone and installed using the traditional recovery procedure. Personally I’d recommend “ClockworkMod Recovery” from Koush and Paul O’Brien, but I’m not sure if it is available for your phone.

Finally

While the actual creation of your own ROM update file is not very complicated, the devil is in the changes you make. Most ROM updates fail at first try, please, have a fresh nandroid backup ready at all times.

, , , , , ,

No Comments

Toshiba X02T (TG01) :: running Android on WinMobile phone

Last year I’ve got WinMobile phone (Toshiba X02T) from SoftBank, also known as TG01 in the rest of the world. I did not like it very much, so basically it slept in the box unused. Recently I’ve noticed some new development and decided to give Android a try, since I really enjoy to run games and software on large 4.1″ screen.

If you don’t like to read the whole thread on XDA-dev, here’s a quick summary: buttons, screen and sound do work, anything wireless (WiFi, GPS, calls, SMS, network access) does not (yet). So, it’s a bit early to use this on everyday phone, but quite good enough to install software and play games.

Current version of Android cannot be flashed to device, but works from SD card instead. To start Android you have to boot Windows first, run Explorer, scroll the file list and click on the .exe file, which will unload Windows and load Linux/Android, which works until power off. Next time the power is on, Windows boots up again, which is good, since I don’t want to lose the warranty and official support.

Linux boots on X02T

Android installation

Installation is quite simple. First you have to download the necessary software (there might be a new version, it’s a good idea to check the original thread for the new version if you are reading this after 2011.01.01). Then, I really loathe this step, you have to find 7zip to unpack the file, since the usual unzip will not work. After the file is unpacked, copy the “Android” folder to the SD card in your X02T phone. There should be some empty space left on the card, since additional files will be created when Android is run for the first time.

To run Android, first start the Explorer, go to SD card, open folder “Android” and run “clrcad.exe” (nothing visible will happen), then “haret.exe”. You should get the Linux boot screen.

Android Home on X02T

It might take a few minutes, and possibly a reboot or two, since hardware is checked and some files are created, but finally there will be initial setup screen and Android home page. Once you got there, everything else is quite easy.

You may read the system log with: adb logcat

The battery indicator might not work, so it’s a good idea to keep the USB cable connected. However, since we need to run the programs from SD card, the USB mode should be changed to ActiveSync once the files are successfully copied to the SD card.

Also, it’s a good idea to watch the temperature of the phone back side to avoid overheating.

Angry Birds on X02T

How to install the software?

Software installation can be done over USB link with ADB:

$ adb install AngryBirds_1.3.5.apk
* daemon not running. starting it now *
* daemon started successfully *
2546 KB/s (13466519 bytes in 5.165s)
pkg: /data/local/tmp/AngryBirds_1.3.5.apk
- waiting for device -
$

, ,

No Comments

“Android Application Development : Programming with the Google SDK”

android application development coverAndroid Application Development
Programming with the Google SDK

By Rick Rogers, John Lombardo, Zigurd Mednieks, G. Blake Meike
Publisher: O’Reilly Media
Released: May 2009

Very nice “no-bullshit” introduction book. A little bit dated, because it’s based on SDK v1.1, and Android development went far ahead since 2009. Also, some of the examples don’t run ‘as is’ with the current SDK, but actually it’s not very important (who runs them anyway?), because the main point of this book — a very concise explanation of Android internals and development process. Explanation, which don’t dig very deep into the unnecessary details, but tells everything you should know to develop for Android. Well, maybe not everything, but just the right amount to get started, including the basic work-flow scenarios and solutions to common problems.

People with no computer background may find this book a bit difficult to read, because there’s no gentle introduction to every aspect of computing and programming, but for someone with even a little experience in computers who tries to jump into Android software development it’s a must have.

,

No Comments