我想通过编程来启用USB tethering,在android.Is it possible.What中调试USB是否有系统权限要在manifest file.Can中声明有人能帮我在编码中解决吗?
发布于 2018-05-25 17:35:43
此代码启用USB tethering
public void enableTethering() {
Object conService= getSystemService(Context.CONNECTIVITY_SERVICE);
for (Method m : obj.getClass().getDeclaredMethods()) {
if (m.getName().equals("tether")) {
try {
m.invoke(conService, "usb0");
} catch (IllegalArgumentException |
IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
}
}
https://stackoverflow.com/questions/50525769
复制相似问题