Does any body know how to call
am start -a ACTIVITY
from uiautomator
code.
Or is it possible to start activity right from junit
It shoule be of with the following code. I use this in my test.
UiDevice device = UiDevice.getInstance(getInstrumentation());
final String TARGET_PACKAGE =
InstrumentationRegistry.getTargetContext().getPackageName();
Context context = InstrumentationRegistry.getContext();
final Intent intent = context.getPackageManager().getLaunchIntentForPackage(TARGET_PACKAGE);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
context.startActivity(intent);
device.wait(Until.hasObject(By.pkg(TARGET_PACKAGE).depth(0)), 5000);