我的目标是清除RAM..For TAT我的想法是重新启动phone..I得到这个代码做针锋相对..重启Android手机通过代码
public static void rebootSU()
{
Runtime runtime = Runtime.getRuntime();
Process proc = null;
OutputStreamWriter osw = null;
StringBuilder sbstdOut = new StringBuilder();
StringBuilder sbstdErr = new StringBuilder();
String command="/system/bin/reboot";
try {
// Run Script
proc = runtime.exec("su");
osw = new OutputStreamWriter(proc.getOutputStream());
osw.write(command);
osw.flush();
osw.close();
} catch (IOException ex) {
ex.printStackTrace();
} finally {
if (osw != null) {
try {
osw.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
try {
if (proc != null)
proc.waitFor();
} catch (InterruptedException e) {
e.printStackTrace();
}
//sbstdOut.append(ReadBufferedReader(new InputStreamReader(proc.getInputStream())));
//sbstdErr.append(ReadBufferedReader(new InputStreamReader(proc.getErrorStream())));
if (proc.exitValue() != 0)
{
}
}
当我执行这个代码,下面的警告显示在logcat ..我给了REBOOT许可也..当我搜索这个,他们告诉像签署一些固件密钥和所有..但我没有意识到这一点..任何帮助,将不胜感激。
在logcat的
04-14 10:37:13.526: WARN/PackageManager(58): Not granting permission android.permission.REBOOT to package com.RebootTest (protectionLevel=3 flags=0x8446)
重新启动以清除RAM?听起来像一个不好的最终用户体验.. – Juri 2011-04-14 06:12:35
是一个新手在这..如果它听起来像一个不好的最终用户体验,给我一个清除内存的解决方案。 – prijin 2011-04-14 09:34:02