How to handle external application activity in and

2020-04-11 11:26发布

I am trying to automate android app(Relocation services)using robotium. In this app there are media section and email and phone native dialer options so when i click on any of this option(Video, audio, phone, email) it takes you to the native app(video,audio, phone, email) of the phone. So how to handle external application activity using robotium(Like click on back button to come back to my app, or close native camera or video app to come back to my app)

Any answer will be great help.

3条回答
▲ chillily
2楼-- · 2020-04-11 11:37

Sorry to bump this...

I've just put the camera stub and gallery stub that I made / use on the play store... thought might be of use to you / others for testing the camera and gallery in automated tests :)

https://play.google.com/store/apps/details?id=com.hitherejoe.CameraStub&hl=en

https://play.google.com/store/apps/details?id=com.hitherejoe.GalleryStub&hl=en_GB

查看更多
Root(大扎)
3楼-- · 2020-04-11 11:40

I think, Using Robotium you can't access other application resources from your target testing application.

Just use Instrumentation for this,

Instrumentation inst = new Instrumentation();
inst.sendKeyDownUpSync(KeyEvent.KEYCODE_BACK);

But be sure if you are doing this in Activity then put this in separate thread for run this code..

查看更多
Summer. ? 凉城
4楼-- · 2020-04-11 11:53

You can only access your own app from within the instrumentation framework. There are some options:

查看更多
登录 后发表回答