0
いくつかのアプリで適切な場所にタップするようにしてください。私はRuntime.getRuntime()。exec()を "入力タップx y"のadbシェルコマンドで使用しますが、それは自分のアクティビティでのみ機能します。私はそれを動作させるために何をすることができますか?外部アプリケーションで「入力タップx y」を使用しないでください
Thread r;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button BtnStart = (Button) findViewById(R.id.btnStart);
try {
Runtime.getRuntime().exec("su");
} catch (IOException e) {
e.printStackTrace();
}
r = new Thread() {
@Override
public void run() {
try{
synchronized (this){
sleep(10000);
}
} catch (InterruptedException e){
}
try {
Runtime.getRuntime().exec("input tap 120 1050");
} catch (IOException e) {
e.printStackTrace();
}
}
};
View.OnClickListener StartClick = new View.OnClickListener(){
@Override
public void onClick(View v) {
StartApp("some.app.here");
r.start();
}
};
BtnStart.setOnClickListener(StartClick);
}
public void StartApp(String AppName){
Intent LaunchApp = getPackageManager().getLaunchIntentForPackage(AppName);
if (LaunchApp != null) {
startActivity(LaunchApp);
}
}