출처 : http://forum.xda-developers.com/showpost.php?p=2954887&postcount=7
They can use the Intent that is exposed by Superuser, that Shell uses to get root:
Code:
final int SUPERUSER_REQUEST = 2323; // arbitrary number of your choosing Intent intent = new Intent("android.intent.action.superuser"); // superuser request intent.putExtra("name", "Shell"); // tell Superuser the name of the requesting app intent.putExtra("packagename", "koushikdutta.shell"); // tel Superuser the name of the requesting package startActivityForResult(intent, SUPERUSER_REQUEST); // make the request!
Then, if the user presses Yes or Always, that Java application can call su just like normal:
Code:
Runtime.getRuntime().exec("su -c <your privileged command here>");
Otherwise, that command will fail.
'Linux > Android' 카테고리의 다른 글
make file 디버깅, LOCAL_PATH , CLEAR_VARS 정체 확인하기 (0) | 2011.09.14 |
---|---|
안드로이드 샘플 소스 (0) | 2011.09.08 |
안드로이드에서 빠른 화면 캡쳐 (0) | 2011.08.29 |
안드로이드 화면 캡쳐해서 저장하는 방법 (0) | 2011.08.29 |
갤럭시탭 PIT Table 덤프하기 (0) | 2011.08.08 |