2014年12月28日 星期日

[Android][AOSP] Run Application in System Process

The method described here is for AOSP make, not including Eclipse and Android Studio build.

In Android.mk, add

LOCAL_CERTIFICATE := platform

In AndroidManifest, under block, add


android:sharedUserId="android.uid.system"

under </application> block, add

android:process="system"

and get back to the project folder and make (command mm) to build the app

To verify, launch the app and check the logcat for log from the app.

If the "Application" column shows "system_process", and the "PID" is the same as other system process (e.g. WindowManager, ActivityManager), then it's successful.

2014年5月5日 星期一

Phoenix on board

SVN url? (done)
Source Insight
Beyound Compare
Personal Data Form give to Crystal.

L:\Phoenix-Tools
M:\Public
M:\SPEC

2012年10月29日 星期一

[Android] Debug with Wifi/Bluetooth Instead of USB

It would be much more convenient if we can develop our Android program without the annoying USB line, isn't it ?

Here's how we do it:

1. Connect your PC and your Android phone to the same Local Area Network

  - For WiFi: Connect them to the same AP or make the PC the network sharing server, and vice versa.

 - For Bluetooth: Share the network of the phone with PC via Bluetooth, and vice versa.

2. Connect your PC to your phone with USB line first

3. Open the command line (or simply Win + R) and type:

    adb tcpip 5555

    which means the connecting port is changed to port 5555

4. type:

  ipconfig -all

  which shows all your network connection, and find the IP of the phone.

  (optional) If you've got Apps such as Airdroid which show the IP of your phone, that would even be better.

5. Unplug the USB line

6. type:

  adb connect xxx.xxx.xxx.xxx:5555 (xxx is the IP of the phone)

 and it's done!

 And to undo all these, just simply type

 adb usb

 and the connection will be back to the USB way.

2012年8月27日 星期一

[Android] AFreeChart Library





-AFreeChart is a free charting library for Android(tm) platform.

- AFreeChart is based on JFreeChart 1.0.13.

JFreeChart

http://www.jfree.org/jfreechart/

- AFreeChart is licensed under the terms of the GNU Lesser General Public Licence (LGPL).

Reference:

[1] 井民全觀點 http://mqjing.blogspot.tw/2012/08/android-afreechart.html
[2] AFreeChart http://code.google.com/p/afreechart/
[3] Screenshots http://afreechart.googlecode.com/svn/doc/screenshot/index.html

2012年8月26日 星期日

[Android] Hide Input Method Panel

In many cases, we type something in the EditText, and then click the Button, but the Input Method Panel doesn't hide itself. Here's the solution:

Add these lines to your Button function, and the panel will disappear at the moment you click!
InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
if(imm != null) imm.hideSoftInputFromWindow(getWindow().getDecorView().getWindowToken(), 0);

2012年8月18日 星期六

[Ubuntu] Install Office 2010 on Ubuntu 12.04

step1:
go to this website http://www.playonlinux.com/en/download.html
choose your Ubuntu version

step2:
For the Precise version(Ubuntu 12.04)
Type the following commands:

wget -q "http://deb.playonlinux.com/public.gpg" -O- | sudo apt-key add -
sudo wget http://deb.playonlinux.com/playonlinux_precise.list -O /etc/apt/sources.list.d/playonlinux.list
sudo apt-get update
sudo apt-get install playonlinux   


step3: Alt+F2 playonlinux


step4: install -> office -> office2010 ->install -> next

step5: you have two option, one is use DVD-ROM ,another is use a setup file in my computer

 you can use DVD-ROM to install or use "Furius ISO Mount" to mount office2010.iso file and choose setup.exe as your setup file to install

here's an example from youtube:
http://www.youtube.com/watch?v=SG01p623BsY






2012年8月17日 星期五

[Android] Keep Service Alive after Screen is Off

Sometimes you just want your background services to keep alive, no matter what happens, even the screen is turned off.
PARTIAL_WAKE_LOCK is just the right thing to do this.


1. Add android.permission.WAKELOCK to your AndroidManifest.xml


2. PowerManager & WakeLock

    claim them as global variable
public class UndeadService extends Service {
  private PowerManager mgr;
  private WakeLock wakeLock;

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
  super.onStartCommand(intent, flags, startId);
  mgr = (PowerManager) getApplicationContext().getSystemService(Context.POWER_SERVICE);
  wakeLock = mgr.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "MyWakeLock");
  wakeLock.acquire();               // activate the wakelock
  return START_REDELIVER_INTENT;
}

@Override
public void onDestroy() {
  wakeLock.release();               // release the wakelock
  super.onDestroy();
}