Monday, March 26, 2012

Google IO: Android client send/receive data between Java server + App Engine + C2DM


Has been awhile did not come and give you a post. I'm recently looking for something that is really worth to share with all of you. I FINALLY FOUND IT.

You: What is this post about?
This is a tutorial that is using Android as client to send and receive data with Java Server. They really provide you a complete code that is working so that you can study from the code!

You: Why not HttpClient / HttpPost / HttpResponse to talk to server?
I would say if you are not really familiar with the above, it will be rather tedious to get it work. so here, Google teach you how to talk to the server using only RequestFactory. Everything done.

You: Give me a rough idea, I'm newbie, i really need to know what is going on?!




You: What is C2DM?
(someone please correct me if I'm wrong)
Cloud to Device Messaging, for me, the best example will be:
Server: "Hey dude, I got something new, come to have a look."
Client: "Okay, update now."

So Now......
Out there, is there any complete code which is working just by clicking File > New?
This is my dream.... and now comes true.



Several prerequisite that you need to get it work.
Eclipse Helios
Google Plugin
C2DM registration - I wait two days after the registration, then my account only activated.
GWT (Google Web Toolkit) plugin for Chrome. (so far no plugin available for Mozilla 11.0)
cloud-task-io - all source code that they do the demo, including all original package, snippets even icons.

Maybe even you work as they mentioned still can't get the thing run. Then stay tune on my next post, I'll share a step by step guide for you.

Monday, July 18, 2011

How to Debug or Run Android application (.apk) on your own Android device from Eclipse

outcome: Click debug, Eclipse will install and run the application from your phone and not virtual device.

Requirement:
Window 7
Eclipse
sync cable (from pc to your phone)

1. Change your phone setting to debugging mode
(Look at your phone)
  • Application->Settings->Applications
    Check "Unknown sources" (unchecked by default for security purposes)
  • Application->Settings->Applications->Development
    Check "USB debugging", I checked "Stay awake" too.
    make sure my phone stay awake when i'm working... train my phone not to be lazy!!! lol~~

2. Make your USB detectable by your pc.
(Although your device might show connected to your pc, if you check on Eclipse debugger list, you can't find your device, some driver is required to be install)
    1. In Eclipse, go to Window->Android SDK and AVD Manager->Available Packages->Third party Add-ons->Google Inc. (dl-ssl.google.com)->
    2. Only Check on Google USB Driver package, revision x.
    3. Click "Install selected".
    1. In Windows,Go to Start->Control Panel->Device Manager
    2. Look for your devices, I'm using Nexus S, so i find my device at Other Devices->Nexus S
    3. Click on the device, and click Update Driver Software at the top
    4. Choose "Browse my computer for driver software"
    5. look for the Google USB Driver package that you just download from Eclipse located at \google-usb_driver\
      (eg..C:\Android SDK\android-sdk-windows\google-usb_driver)
    6. Check or no check subfolder, up to u la. (I checked)

  • Last part, go back Eclipse to check if your device is available in the list.
    1. Go Run->Debug Configurations...
    2. Target tab->Deployment Target Selection Mode set to Manual
    3. Click Debug (At this point, make sure device is connected to pc, debugging mode from your device is ON)
3.Make your application debuggable
(Back to your project)
  • Before you debug
    1. Go to AndroidManifest.xml of your application
    2. Select Application tab
    3. Debuggable field select "true"



That is it, try debug your project, .apk is now installed and run on your device.

Thursday, April 28, 2011

Android Development forecast 1st half 2011

Do you think you are worth to be the Android developer better than iApps Developer?
Several opinions make you feeling it make sense.
1. USD25 lifetime as an Google Android market developer (Apple USD99 per year)
2. Base on the graft below, the blue line shows Android development forecast whereas Apple App Store development for iPhone is shown on the top, green line. We probably can see that the development of Android is growing sharply upwards and they predict that July will overtake Apple App Store Development.



source: cnet News

Saturday, April 9, 2011

Accessing Emulator File System

In Eclipse, we are wondering where those files or mounted drive save at?
Is it any folders in Windows? Is not actually a folder, I can said is kinda virtual.

This post shows you how to enter the file system.
Is very easy actually.

Launch your emulator,
Window > Open Perspective > DDMS
or you may find an android at the top right like below


Please look for the File Explorer, all of the files and folder are located there.
If you would like to find all files that created during your testing and saved into the emulator, please find it under
data/data/your project package/files

If you want to check for the external storage or new mounted volume like sdcard, please find it under
mnt/
(at least mnt/sdcard/LOST.DIR will be available if you inserted any sdcard into the project, want to know how, please go add sdcard in android emulator / setup sdcard)

Add SdCard in android emulator / Setup SDCard

For Windows + Eclipse user only,
others please refers to http://www.brighthub.com/mobile/google-android/articles/33240.aspx


To create SDCard is quite straight forward, cause you just have to follow as below.

Go to C:\[SDK dir]\android-sdk-windows\tools
mksdcard 512M mysdcard.iso



you may check with dir/w to see if the *.iso is created.

Choose either 1 way,
1. Use existing avd and mount the sdcard with command line
2. Create a new AVD

1. Use existing avd and mount the sdcard with command line
Go to your Eclipse, right click the project that you want to inject the sdcard.
Choose Run As > Run Configurations...


go to the Target tab in the middle
type in the command line with
-sdcard [dir]/mysdcard.iso
For my example, i make an extra step which is paste the created mysdcard.iso into the project like paste to C:/Users/Rickie/workspace/Helloworld/mysdcard.iso

I use this step to avoid spacing, the command line now will be -sdcard "C:\Users\Rickie\workspace\HelloWorld\mysdcard.iso"
Please let me know if you know how to avoid spacing, looks like i can't avoid it although I use "double quote"
2. Create a new AVD
Go to Window > Android SDK and AVD Manager and create new Android device.
If you don't know how to create AVD, please go Create Android Virtual Device(AVD) .
In “SD Card” option specify “File” and navigate to sdcard.iso created earlier.



When you done adding sdcard, I'm sure you want to check if the mysdcard folder already inside the FileSystem.
If you not sure how, please refers to Accessing Emulator File System.

Or you can just start the emulator, check on the setting > SD card & phone storage settings to check if the SD card is mounted.

Tuesday, March 1, 2011

Android Phone Suggestion

Always got people ask me about which is a good phone to use? And i asked myself what is a good phone for development. So I decided to make this post.

All phone suggested below is my own opinion, I'll try to list out all android phone which up to date and which good for developer. All will be my own view, if you feel annoying, nasty, don't screw me please.

So far I only view several brands of mobile phone, so if you want me to comment on some new or rare model, drop me an email / just comment it.

As an Android developer, I will not talk about IOS, Windows Phone 7 and Symbian. I'll only focus on Android phone. All phone information are grabbed from http://www.gsmarena.com/ and http://www.engadget.com/

My Choice
  • Samsung Galaxy S II (released date before May - source)
    check the spec yourself. I like it because of Android 2.3, NFC enabled, bigger and screen, stronger battery life, greater camera than Samsung Nexus S. Only lack is, it is not a Google phone.

Developer View of Choice
  • Samsung Nexus S - Google Phone, can get fastest update for Android, 1Ghz CPU speed and 16GB internal Storage, NFC enabled; come originally with Android 2.3 (GingerBread)
  • HTC Nexus One - Google Phone, can get fastest update for Android, 1Ghz CPU speed and only using card slot for memory (microSD); come originally with Android 2.1 (Eclair, update-able to 2.3 Android)
  • HTC Sensation - come with HTC Sense v3.0, 1.2 GHz dual-core processor, bigger screen; come with Android 2.3 (GingerBread)
Nexus One is cheaper and with HTC Sense which I felt user friendly, so you may take it into consideration.

User View of Choice
  • HTC Flyer (probably in 2.4 - GingerBread) - stylus (Scribe technology) touch my heart
  • LG Optimus 2X (2.2 - Froyo) - Tegra 2 chipset by NVIDIA for gaming
  • Motorola Xoom and Samsung Galaxy Tab 10.1 ( 3.0 - HoneyComb) - I'm a bee, honey ask me come closer; but it is a huge hand held device, good for those who want to show off. (Expected April 2011)
  • Motorola Milestone 2 (2.2 - Froyo) - Suit for those who expect to have a qwerty keyboard in his phone
  • SE Xperia Arc (2.3 - GingerBread) - Stylish design.
  • HTC Incredible S (2.2 - Froyo, upgradable to 2.4) - design really not bad and with an affordable price

Good But Not Advisable
  • HTC Thunderbolt 4G - lack of battery life; for phone dialing, using CDMA only but not GSM (Expected April 2011)
  • HTC Desire HD - lack of battery life
  • Dell Streak - weird design and special size, 5inch; I saw Android v1.6(upgradable). lol~~
  • SE Xperia Play - Is a gaming device, if you are a gamer, i suggest you buy PS3 or NGP + a normal phone take can make phone call and sms.... enough already.

Updated 28/4/2011
Please let me know if this post is outdated. Thanks.

Statistics (2009 - Jan 2011)

The following video showing data visualization of Android activation all over the world.
With this video, you can see that Android user groups are growing larger and larger, soon Android will cover all over the world and become very common in fact.

This makes us will not regret to become one of the Android developer.
Hope this video may motivate you to go further.




Regarding to Gartner: Android smartphone sales surged 888.8% in 2010. source: 9-Feb-2011
So what are you waiting for to become another Android developer?
Lets the open source keep rolling and show everyone your creativity.