Disabling first-run greeter on fresh android emulator

后端 未结 2 621
滥情空心
滥情空心 2021-01-24 08:29

I am writing a test that requires launching application directly from launcher. Because I can\'t emulate it correctly by launching through intent.

The problem is that wh

2条回答
  •  佛祖请我去吃肉
    2021-01-24 08:52

    Have you tried using PackageManager.getLaunchIntentForPackage(..)? This will allow you to send the same Intent that the launcher uses to start your app. It should be equivalent to clicking on your application's launcher icon.

    If you do need to go through the launcher, you can use a UiWatcher to dismiss the first-run overlay. Whenever UiAutomator can't find an element, it will call the checkForCondition(..) method for each registered UiWatcher and give you a chance to dismiss any overlays or dialogs that are getting in the way.

提交回复
热议问题