Showing posts with label android. Show all posts
Showing posts with label android. Show all posts

Friday, March 30, 2012

how to get the android_id from an avd/emulator


Just a couple of commands take care of this. What's nice is that this can be automated from the shell, and can thus be included in scripts and in CI (e.g. in Jenkins)

[16:23:59] ~ $ adb -s emulator-5556 pull  /data/data/com.android.providers.settings/databases/settings.db
194 KB/s (24576 bytes in 0.123s)

[16:38:59] ~ $ sqlite3 settings.db "select value from secure where name='android_id'"
9774d56d682e549c

The output of the sqlite3 command is the required android_id:  9774d56d682e549c

Wednesday, November 16, 2011

how to add multiple ip addresses to loopback and ping an AVD's host machine

From my Android Virtual Device I was trying to figure out how to connect to a service running on the same machine running the emulator.

For example, let's say I'm running Apache on my laptop, and also running the AVD on my laptop. In a browser on my laptop I can type "http://localhost/index.html" to test the index.html present in my Apache webroot.

But if I put "http://localhost/index.html" in the Android browser in the AVD, I don't get anything. That's because 'localhost' refers to the AVD itself, not the host outside the AVD.

This stackoverflow question saved the day: it turns out that from within the AVD you can ping the host machine at 10.0.2.2 - this is a kind of hard-coded virtual IP address in Android emulators for the host box.


Next, I wanted to make 10.0.2.2 go to localhost so that when I play a URL from the logs like http://10.0.2.2:8080/sms/srs?merch_txn_id=AK0AqgCkAMIAwwB5AOMAeA%3D%3D&i3p_db=ptsqa_fortumo3&i3p_host=10.0.2.2%3A5432&country=US
I don't want to have to replace 10.0.2.2 with localhost every time in every URL.

This part of the puzzle was solved by this very helpful link : I simply had to create a virtual IP address for the loopback device via:
ip -4 addr add 10.0.2.2/32 dev lo

After this we can see that 10.0.2.2 is an alias for the loopback interface, "lo":

[02:24:26] ~ $ ip addr
1: lo:  mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet 10.0.2.2/32 scope global lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever

Tuesday, November 2, 2010

coming soon! the awesome galaxy tab!

a thing of beauty...
The iPad seems to be taking forever to arrive on Indian shores. The so-called "Global iPad Launch" (that happened in May 2010) left out India egregiously and Apple fanboys here have been waiting ever since. Nearly 6 months on, there isn't so much as an iPad launch date on the Apple India website. So India doesn't seem to figure much in Apple's plans.

Which is GREAT as far as Desi Droidheads are concerned :)

Samsung has always given India a high priority, and the launch of the awesome Android2.2-powered Galaxy Tab is no exception. According to Samsung Mobile India, the Galaxy Tab is launching on Friday, 10th November - almost a week from now!

The make-or-break metric for a country like India is price, and this too seems to be in the favor of the Galaxy Tab. It's priced at Rs 38,000. This isn't exactly cheap, but it's not exorbitant either.

the Layar reality browser in action
The iPad 64GB (with WiFi and 3G) version costs $829 in the US (which roughly translates to Rs 37,000), so it will definitely retail for more than 40k, if-and-when it gets here. In fact, a quick ebay.in search reveals that the iPad 64GB (+WiFi +3G) is available in India  (US purchases being re-sold here, presumably) for around Rs. 50,000. The better price point for the Galaxy Tab, coupled with its early launch should well entrench Samsung on Indian soil to take on the iPad (assuming it even gets here :)

Check out this nice side-by-side comparison of the two tablets by PCWorld. And here's a beautiful tech spec comparison that might help you decide which is better for you.

In my mind, the Galaxy Tab is a clear winner thanks to its:
  • higher pixel density
  • front-and-rear cameras
    (hence video-calling, videoconferencing ability, which the iPad sorely lacks)
  • expandable microSD storage
  • smaller, lighter frame
    (hence a more comfortable form-factor)
  • better price point

Way to go, Samsung!

(Galaxy Tab pictures courtesy of Samsung)

Monday, November 1, 2010

android: already leaving iphone in the dust?

I couldn't be happier for my favorite mobile platform.

According to this news article on the Wall Street Journal, as far as Q3 2010 sales go, Android has finally leapt ahead of all other smartphone platforms.

According to that same article, Mr. Jobs isn't happy and is railing Android over how developers need to release various versions of apps to support the multitude of Android variants in the market. Well, yeah, that is a bit of an issue, but some work around it by just releasing for the very first Android releases: Donut (1.6) or cupcake (1.5). This way you're a bit limited by features, but you're assured of forward-compatibility. Also, I don't think too many developers are really bothered by this issue, at least going by the explosive growth of the Android Market :)

Ever since I got my Eclair (Android 2.1) smartphone a couple of months ago, I've known that this is going to be the future of mobile computing. I bet Samsung's Galaxy Tab (which has generated huge buzz in pre-release) will only consolidate my hopes for the platform.

Woohoo, Android!