Chủ Nhật, 5 tháng 12, 2010

Lập trình với: Google Android Mobile

Lập trình với: Google Android Mobile

Đã từ lâu bạn mê mẩn với các ứng dụng tiện ích thông minh của Google. Từ hệ thống email siêu tưởng 7GB (Google Mail), hệ thống chia sẻ văn bản dành cho văn phòng (Google Docs) cho đến các hệ thống định toàn cầu của Google Map, Google Earth. Tất cả chúng đều mang một phong cách riêng của Google, phong cách của sự sáng tạo.
Đầu năm 2009, Google tung ra thị trường hệ điều hành đầu tiên của mình dưới cái tên Google Android. Phiên bản đầu tiên của Android chạy trên các thiết bị Mobile. Cũng giống như các phần mềm khác của Google, Android hỗ trợ rất tốt cho các ứng dụng viết bằng ngôn ngữ Java.
Và tuyệt với hơn nữa, Google cung cấp riêng một SDK giúp các lập trình viên dễ dàng hơn trong việc viết nên các ứng dụng chạy trên Android. Google hứa hẹn sẽ tung ra phiên bản Android cho máy PC vào đầu năm 2010 và đánh chiếm một phần thị trường hệ điều hành rất tiềm năng này. Lúc ấy, các lập trình viên Java chắc chắn sẽ có nhiều đất để dụng võ.
Vậy bạn có sẵn sàng để trở thành một lập trình viên? Hãy thử một lần xem sao nhé:
Bước 1: Chuẩn bị các công cụ cần thiết
1. Download Google Android SDK tại địa chỉ
http://code.google.com/android/download.html
Giải nén và đặt vào thư mục C:\tools\android
2. Download công cụ build Ant tại địa chỉ
http://ant.apache.org/bindownload.cgi
Giải nén và đặt vào thư mục C:\tools\ant
3. Nếu bạn chưa có JDK hãy download tại địa chỉ
http://java.sun.com/javase/downloads/index.jsp
Cài đặt JDK vào thư mục C:\tools\java
4. Nếu muốn phát triển các ứng dụng có giao diện đồ hoạ trên Android, bạn hãy download thêm framework DroidDraw tại địa chỉ
http://code.google.com/p/droiddraw/
Sau đó cũng giải nén vào thư mục C:\tools\droiddraw
5. Đừng quên đặt các biến môi trường ANT_HOME và JAVA_HOME với giá trị tương ứng là C:\tools\ant và C:\tools\java. Sau đó thêm vào biến CLASSPATH đường dẫn tới thư mục bin của Ant và Java (C:\tools\ant\bin  C:\tools\java\bin). (để thiết lập biến môi trường: click chuột phải vào My Computer -> Properties -> Advanced -> Environment Variables)
Bước 2: Triển khai ứng dụng HelloWorld trên Android
Khi chạy ứng dụng này, rất đơn giản, sẽ có dòng chữ “Hello, World” xuất hiện trên màn hình điện thoại.
1. Khởi động trình mô phỏng (Emulator) bằng cách chạy C:\tools\android\tools\ emulator.exe. Nếu mọi việc tốt đẹp, trình mô phỏng máy điện thoại Google Phone thế hệ 1 chạy Google Android sẽ xuất hiện trên màn hình
2. Sau khi emulator khởi động xong, ta vào chế độ dòng lệnh, chuyển sang thư mục C:\tools\android\tools
3. Thực thi lệnh sau đây để tạo ứng dụng đầu tiên lên điện thoại
C:\tools\android\tools>activitycreator.bat --out tipcalc com.android.tipcalc
4. Sau khi chạy xong, ta thấy xuất hiện thư mục tipcalc. Thực thi tiếp lệnh:
C:\tools\android\tools>cd tipcalc
C:\tools\android\tools\tipcalc>ant
5. Cuối cùng thực hiện lệnh sau để cài đặt ứng dụng lên điện thoại
C:\tools\android\tools\tipcalc>..\adb install bin\tipcalc-debug.apk
6. Bây giờ ta vào menu chính của điện thoại, icon của ứng dụng tipCalc sẽ xuất hiện:
7. Nhấn đúp chuột vào icon trên màn hình để chạy ứng dụng tipCalc
Tip *** Nếu bạn muốn phát triển một ứng dụng có giao diện đồ hoạ, thật đơn giản, khởi động framework DroidDraw bằng cách chạyC:\tools\droiddraw\droiddraw.exe.
Trả lời với trích dẫn

Thứ Bảy, 4 tháng 12, 2010

How to root Liquid E

REQUIREMENTS:
OS: Windows/Mac
Other: USB cable
Unlocks bootloader: Yes (You can install custom ROMs)
Steps:
1. Enable "USB Debugging" on the phone under Settings->Applications->Development->USB debugging
2. Download and extract the latest Android SDK 
3. Download and install fastboot drivers
4. Open up a command prompt (Windows) or terminal (Mac), and browse to where you just extracted the SDK and browse to the "tools" folder under command prompt (if extracted to c:\tools and you are in c:, type 'cd c:\tools")
5. Download the latest malezrecovery custom recovery disk image and put it into the "tools" folder.
6. Connect your phone to your computer.
7. In the command prompt, type "adb devices" (NO QUOTES). You should see if your device is detected by your computer. If there's nothing showing under 'List", you don't have the drivers installed (Go back to step 3 and install the drivers)
8. Now we will install the custom recovery. Still in command prompt, type:
(replace NAME.img with the filename of the malezrecovery custom recovery disk image you just downloaded)
Code:
adb reboot bootloader
fastboot -i 0x0502 flash recovery NAME.img 
fastboot -i 0x0502 reboot
When you are done, it will say something like this on your computer: sending 'recovery' (4876 KB)... OKAY writing 'recovery'... OKAY
This will reboot your phone back into the normal firmware.
9. Now you need to get into the custom recovery by typing "adb reboot recovery" (NO QUOTES) into command prompt. At this point your phone will reboot.

How to Root the Acer Liquid A1

Guide to Root the Acer Liquid a1:

Step 1: Download and install the Acer Liquid drivers for your windows version.
Step 2: Download the Acer Liquid 2.1 Firmware and save it on your desktop.
Step 3: Download the Acer Flashing Tool and run it. Browse to the .bin file from Step 2 and select it.
Step 4: Connect the smartphone to the PC using an USB cable and click Start into the flashing tool.
Step 5: Download Superboot and extract the .zip file.
Step 6: Double-click on the Superboot.bat file and wait for the reboot.
Rooting is a process that grants the user full access to his phone. That means system files modifications, the installing of forbidden applications, changing the icons and so on.
You can basically do whatever you want with it. You can even unlock the phone and use it on any carrier or take advantage of its tethering abilities.
Acer users can now rejoice on the thought that you can root the Acer Liquid a1. The lines bellow will guide you towards the routing process and also, it will upgrade the phone to Android 2.1.
The Acer Liquid A1
The Acer Liquid A1
Before you get started, you need to know that if you choose to root, you will lose the warranty and could end up with a bricked phone, if you do not follow our steps carefully.

How to root Liquid E to 2.1


I. Before You Begin


This will give you root access and upgrade you to Android 2.1


II. Download and install the Liquid Drivers

1. Download the drivers

Acer Liquid Drivers

(x86 for 32bit Windows, x64 for 64bit Windows)

2. Click Acer Liquid Tool Setup and follow the steps to install the drivers.

III. Flash the Firmware with the Acer Flashing Tool

1. Download the Acer Liquid 2.1 Firmware

2. Save the .bin file somewhere on your computer that you can find it easily later.

3. Download the Acer Flashing Tool

4. Run the Acer Download Tool and click Browse. Then look for the .bin file we downloaded earlier and click that.

5. Connect your phone to the computer via usb and then click Start in the Download Tool.

*I ran into an issue where it said Not Connected while Starting AMSS. Wait a good 5 minutes and if it is still stuck, remove the usb cable and put it back in, this fixed it for me.

6. Once it reboots, goto Menu > Settings > Applications > Development > Check ON USB Debugging.

IV. Install Superboot and Custom Recovery Image

1. Download Superboot2.zip

Superboot.zip

(updated 6/23/10)

2. Unzip the superboot.zip file.

3. Double click on the reboot-bootloader-windows.bat file and wait for the phone to boot into bootloader mode.

4. Then double click the install-superboot-windows.bat file and wait for it to finish. The phone will reboot.

5. Double click on the reboot-bootloader-windows.bat file and wait for the phone to boot into bootloader mode.

6. Then double click the install-recovery-windows.bat file and wait for it to finish.

7. Once it reboots, you are all set! You have root access, Android 2.1, and a custom recovery image to flash ROMs with!

NOW, you can load custom ROMs! Head over to our How To Load a Custom ROM on the Acer Liquid

procedure for how to get started.

Liquid E - root access and upgrade to Android 2.1

I. Before You Begin

1. This will give you root access and upgrade you to Android 2.1

II. Download and install the Liquid Drivers

1. Download the drivers

Acer Liquid Drivers (x86 for 32bit Windows, x64 for 64bit Windows)

2. Click Acer Liquid Tool Setup and follow the steps to install the drivers.

III. Flash the Firmware with the Acer Flashing Tool

1. Download the Acer Liquid 2.1 Firmware

Acer Liquid Rooted Firmware

2. Save the .bin file somewhere on your computer that you can find it easily later.

3. Download the Acer Flashing Tool

Acer Flashing Tool

4. Run the Acer Download Tool and click Browse. Then look for the .bin file we downloaded earlier and click that.

5. Connect your phone to the computer via usb and then click Start in the Download Tool.

*I ran into an issue where it said Not Connected while Starting AMSS. Wait a good 5 minutes and if it is still stuck, remove the usb cable and put it back in, this fixed it for me.

6. Once it reboots, goto Menu > Settings > Applications > Development > Check ON USB Debugging.

IV. Install Superboot and Custom Recovery Image

1. Download Superboot2.zip

Superboot.zip (updated 6/23/10)

2. Unzip the superboot.zip file.

3. Double click on the reboot-bootloader-windows.bat file and wait for the phone to boot into bootloader mode.

4. Then double click the install-superboot-windows.bat file and wait for it to finish. The phone will reboot.

5. Double click on the reboot-bootloader-windows.bat file and wait for the phone to boot into bootloader mode.

6. Then double click the install-recovery-windows.bat file and wait for it to finish.

7. Once it reboots, you are all set! You have root access, Android 2.1, and a custom recovery image to flash ROMs with!

NOW, you can load custom ROMs! Head over to our How To Load a Custom ROM on the Acer Liquid procedure for how to get started.

How to root Liquid E to 2.1


II. Download and install the Liquid Drivers

1. Download the drivers

Acer Liquid Drivers

(x86 for 32bit Windows, x64 for 64bit Windows)

2. Click Acer Liquid Tool Setup and follow the steps to install the drivers.

III. Flash the Firmware with the Acer Flashing Tool

1. Download the Acer Liquid 2.1 Firmware

2. Save the .bin file somewhere on your computer that you can find it easily later.

3. Download the Acer Flashing Tool

4. Run the Acer Download Tool and click Browse. Then look for the .bin file we downloaded earlier and click that.

5. Connect your phone to the computer via usb and then click Start in the Download Tool.

*I ran into an issue where it said Not Connected while Starting AMSS. Wait a good 5 minutes and if it is still stuck, remove the usb cable and put it back in, this fixed it for me.

6. Once it reboots, goto Menu > Settings > Applications > Development > Check ON USB Debugging.

IV. Install Superboot and Custom Recovery Image

1. Download Superboot2.zip

Superboot.zip

(updated 6/23/10)

2. Unzip the superboot.zip file.

3. Double click on the reboot-bootloader-windows.bat file and wait for the phone to boot into bootloader mode.

4. Then double click the install-superboot-windows.bat file and wait for it to finish. The phone will reboot.

5. Double click on the reboot-bootloader-windows.bat file and wait for the phone to boot into bootloader mode.

6. Then double click the install-recovery-windows.bat file and wait for it to finish.

7. Once it reboots, you are all set! You have root access, Android 2.1, and a custom recovery image to flash ROMs with!

NOW, you can load custom ROMs! Head over to our How To Load a Custom ROM on the Acer Liquid

procedure for how to get started.

Tăng tốc Android OS

Chúng ta có 2 nguyên nhân để làm điều này:
- Nếu ta muốn giảm độ phân giải của màn hình Android để từ đó tăng tốc độ xử lý của CPU và tối ưu hóa lưu trữ của RAM.
- Nếu ta muốn tăng độ phân giải vì màn hình chúng ta lớn (khoảng 4.3 inch trở lên), tốc độ CPU mạnh (trên 800 Mhz) và RAM tương đối nhiều (trên 512 MB). Việc tăng độ phân giải sẽ giúp ta có nhiều không gian hơn để thấy được nhiều item hơn, tuy nhiên kích cỡ các item sẽ nhỏ hơn trước, bù lại chất lượng hình ảnh sẽ mượt mà hơn.
Những điều cần biết trước khi thực hiện:
- Cấu hình máy của bạn phải mạnh RAM >= 256, CPU >= 600Mhz, màn hình nên khoảng 3,7 inch trở lên.
-HDH Android trên máy bạn là phiên bản 2.1 trở lên và đã được ROOT (Nếu chưa root xin làm theo hướng dẫn sau How to root Android 2.1 và How to root Android 2.2).
-Bạn có android SDK tool trên máy, nếu chưa có bạn có thể down từ  Google, hoặc dùng bản thu gọn của mình ở đây
-Có cài đặt phần mềm quản lý file hệ thống như ASTRO trên máy Android (nếu chưa có bạn vào Google market search ASTRO và download về)
Các bước tiến hành:
Bước 1: Chép file build.prop lên PC của bạn bằng cách sau:
-Mở ASTRO, di chuyển đến thư mục system (nằm ở cấp root), copy file build.prop và paste nó vào thư much sdcard
screenshot 1 copy Cấu hình độ phân giải màn hình Androidscreenshot copy Cấu hình độ phân giải màn hình Androidscreenshot Cấu hình độ phân giải màn hình Android
-Sau đó connect điện thoại với PC qua USB, chép build.prop ra ngoài (Lưu ý khi chép lên PC chúng ta cũng nên backup lại 1 bản build.prop)
Bước 2: Chỉnh sửa thông số LCD Density trong build.prop
Mở file build.prop bằng chương trình edit text (như  editplus hoặc notepad)
Screenshot Studio capture 065 Cấu hình độ phân giải màn hình AndroidĐến dòng 39 này bạn sẽ thấy thông số lcd_density: Thông số này càng lớn thì độ phân giải càng nhỏ, thông số càng nhỏ thì độ phân giải càng lớn.
240 là  ứng với độ phân giải 480 x 854 mặc định của Motorola Droid (Ở đây mình chỉnh 280 để giảm độ phân giải của màn hình Android, tăng tốc CPU và RAM)
Nếu máy bạn đủ mạnh, hãy hạ xuống 200 để tăng độ phân giải màn hình: thiết bị của bạn sẽ hiển thị được nhiều hơn, hình ảnh mịn hơn bù lại mọi thứ  sẽ nhỏ hơn trước.
Sau khi chỉnh thông số lcd_density xong hãy save lại, chuyển qua bước tiếp theo.
Bước 3: Chép build.prop vào thư mục system của HDH Android.
-Bật chế độ “Debug” dành cho developer trên phone của bạn: Settings >> Application Settings >> Development >> check “USB Debugging”.
Sau đó connect phone của bạn vào PC qua USB
screenshot 1 copy1 Cấu hình độ phân giải màn hình Androidscreenshot 2 copy Cấu hình độ phân giải màn hình Android
-Sau khi bạn đã download SDK tool mà mình đã nói ở trên (bản thu gọn của mình ở đây) và giải nén nó , hãy chép file build.prop đã chỉnh sửa vào thư mục mà bạn giải nén
Screenshot Studio capture 067 Cấu hình độ phân giải màn hình AndroidMình ví dụ bạn giải nén ở địa chỉ C:adb. Để chép build.prop lại thư mục system ta phải làm 2 bước là chép nó vào sdcard rồi từ sdcard ta chép vào thư mục system. Ta không thể làm điều này bằng ASTRO vì nó đòi hỏi quyền root, nên ta phải dùng ADB tool của Google.
-Mở command prompt lên và chuyển đến thư mục C:adb bằng lệnh sau: cd C:adb
-Chép file build.prop vào sdcard: adb push build.prop /sdcard/build.prop
-Để chép buid.prop từ  sdcard vào thư mục system của Android ta phải chuyển qua command ở chế độ developer: adb shell
Khi dấu $ xuất hiện ta nhập vào: su
-Khi dấu # xuất hiện ta nhập vào: mount -o remount,rw /dev/block/system /system
-Sau đó chép build.prop từ sdcard lên thư mục system của Android: cp /sdcard/build.prop /system/build.prop
Screenshot Studio capture 071 Cấu hình độ phân giải màn hình AndroidLưu ý khi chép vào thư mục system trên phone bạn sẽ xuất hiện dialog đòi bạn xác nhận có cho quyền chép ko, nhấn acccess để cấp quyền.
Cuối cùng khởi động lại phone của bạn để thấy sự thay đổi :)