android apk 怎么执行adb shell命令
来源:互联网 发布:淘宝转化率提升 编辑:程序博客网 时间:2024/06/08 02:02
adb shell getprop ro.telephony.default_network
adb shell setprop ro.telephony.default_network
android apk 怎么执行adb shell命令
1:权限问题,很重要:
》1,把你的APK预置到andriod代码里面,加上系统权限:LOCAL_CERTIFICATE := platform
Android.mk文件内容:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_CERTIFICATE := platform
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_SDK_VERSION := current
LOCAL_PACKAGE_NAME := ddr
include $(BUILD_PACKAGE)
# Use the following include to make our test apk.
include $(call all-makefiles-under,$(LOCAL_PATH))
2》,AndroidManifest.xml文件加上系统主线程权限:android:sharedUserId="android.uid.system
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.ddr"
android:versionCode="1"
android:versionName="1.0"
android:sharedUserId="android.uid.system">
3》,APK调用adb shell命令方式:
private static final String TAG = null;
String args0 = "screencap -p /sdcard/screen.png";
String args1 = "am start -n com.android.dialer/com.android.dialer.DialtactsActivity";
//String args3 = "csh";
String simpleMemtester_1 = "memtester -b -g -f 1190400--1190400 64M 1";
String complexMemtester_1 = "memtester -b -j 0 -k 4 -g -l 40 -a 64M";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
System.out.println("csh ddr star");
Memtester(simpleMemtester_1);
System.out.println("csh ddr stop");
}
public static void Memtester(String command)
{
Runtime r = Runtime.getRuntime();
Process p;
try {
p = r.exec(command);
BufferedReader br = new BufferedReader(new InputStreamReader(p
.getInputStream()));
String inline;
while ((inline = br.readLine()) != null) {
System.out.println(inline);
}
br.close();
p.waitFor();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
- android apk 怎么执行adb shell命令
- Android Java代码执行adb Shell命令
- Android Java代码执行adb Shell命令
- Android Java代码执行adb Shell命令
- android程序执行adb shell命令
- 在apk 中执行Runtime.getRuntime().exec adb shell各种命令远程控制其他Android设备(一)
- window下andorid开发,怎么快速执行adb shell-cmd 怎么执行多个命令
- C#执行adb shell命令
- 怎么在Android Studio中执行adb命令
- Android adb shell 命令
- Android adb shell 命令
- Android adb shell 命令
- Android adb shell 命令
- Android adb shell 命令
- android adb shell命令
- android-adb shell命令
- android adb shell 命令
- Android adb shell 命令
- mysql update报错
- SVG path 关键字解释
- CSS进阶:试试酷炫的 3D 视角
- 我的C语言之路
- IDOR漏洞接管Facebook页面,获1万6千美金奖励
- android apk 怎么执行adb shell命令
- java8 方法或构造函数的引用
- UVA 10375
- Android中数据加密
- iOS UILabel详解
- CentOS6.5更新Python
- Neutron 理解(5):Neutron 是如何向 Nova 虚机分配固定IP地址的 (How Neutron Allocates Fixed IPs to Nova Instance)
- VC调试boost::asio::async_send_to时候的一个问题(_Debug_message assert的异常)
- -exec