List of usage examples for android.app Instrumentation startActivitySync
public Activity startActivitySync(Intent intent)
From source file:love.juhe.androidmonkey.MonkeyActivityEvent.java
@SuppressLint("NewApi") @Override//from w w w . j a v a 2 s.com public int fireEvent(Instrumentation testRuner) { Intent intent = getEvent(); MonkeyLog.l(":Switch: " + intent.toUri(0)); if (mAlarmTime != 0) { Bundle args = new Bundle(); args.putLong("alarmTime", mAlarmTime); intent.putExtras(args); } try { // IntentFilter filter = new IntentFilter(getEvent().getAction()); // ActivityMonitor monitor = testRuner.addMonitor(filter, null, true); testRuner.startActivitySync(intent); // testRuner.waitForMonitorWithTimeout(monitor, 10); } catch (SecurityException e) { MonkeyLog.l("** Permissions error starting activity " + intent.toUri(0)); return MonkeyEvent.INJECT_ERROR_SECURITY_EXCEPTION; } return MonkeyEvent.INJECT_SUCCESS; }