android实现静默安装示例
2018-07-20 来源:open-open
1、需要RootTools.jar
2、执行脚本
public class InstallerActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
try {
Runtime.getRuntime().exec("su");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void click(View view){
EditText et = (EditText) findViewById(R.id.editText1);
String path = et.getText().toString().trim();
try {
RootTools.sendShell("/system/bin/pm install -r "+path, 30000);
} catch (Exception e) {
e.printStackTrace();
}
}
}
标签: 脚本
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点!
本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。
下一篇:C#实现文件下载,支持断点续传
最新资讯
热门推荐