Re: How do I discard or close a system message box

163 views
Skip to first unread message

naveed

unread,
May 20, 2013, 1:41:43 AM5/20/13
to robotium-...@googlegroups.com
can you try solo.goBack(). 

On Thursday, May 16, 2013 10:50:08 PM UTC+5, Franck Derunes wrote:
Hi,

I am running the device in Airplane mode.
Before I start the test, I reboot the phone using adb command

When the phone starts, it brings up to the front a message box asking if  you want to disable airplane mode.

solo.getCurrentActivity will return my app activity that is on the background. But I can't get the app to go foreground.

How can I interact with the system message box to close it?
or how can I put my app on the foreground?





naveed

unread,
May 23, 2013, 1:22:10 AM5/23/13
to robotium-...@googlegroups.com
ok so you can use goBackToActivity(String name)

On Wednesday, May 22, 2013 3:09:39 AM UTC+5, Franck Derunes wrote:
solo.goBack() exits my app

naveed

unread,
May 28, 2013, 2:44:38 AM5/28/13
to robotium-...@googlegroups.com
Can you try this code, it may work in your case.

private void getFocus() {
       @SuppressWarnings("rawtypes")
       Class a = YourActivity.class;
       getInstrumentation().setInTouchMode(true);
       Intent intent = new Intent(Intent.ACTION_MAIN);
       intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
       intent.setClass(getInstrumentation().getTargetContext(), a);
       setActivity((Activity) getInstrumentation().startActivitySync(intent));
   }

Let me know if it helps

On Saturday, May 25, 2013 1:30:50 AM UTC+5, Franck Derunes wrote:
that does not work, I get 
junit.framework.AssertionFailedError: No Activity named: 'com.myapp.myactivity' has been priorly opened
at com.jayway.android.robotium.solo.ActivityUtils.goBackToActivity(ActivityUtils.java:274)
at com.jayway.android.robotium.solo.Solo.goBackToActivity(Solo.java:2072)
at com.myapp.test.Test_firstStart.setUp(Test_firstStart.java:63)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:190)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:175)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:555)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1614)

it depends on what phone you are using. For some of them that I have, if you set Airplane mode, when you boot your phone it will show this popup on the top of everything, asking if you want to disable airplane mode. I need to get ride of it, because of it robotium can't see anything about the activity it launched.

naveed

unread,
May 31, 2013, 1:49:07 AM5/31/13
to robotium-...@googlegroups.com
Oh I should work, 
can you please send me your aut and testProject code if possible, let me try something here. 

On Thursday, May 30, 2013 10:21:49 PM UTC+5, Franck Derunes wrote:
Hi Naveed, no luck with this. The message stays on the top. The app activity is not brought to the front.
Thank you for trying to help

naveed

unread,
Jun 7, 2013, 2:30:50 AM6/7/13
to robotium-...@googlegroups.com
Frank, 

I am out of US, I'll try to 

"if you set your phone in airplane mode, when you reboot some phone will display a system popup. The idea would be to be able to get a handle on the the system popup to close it.
That said, more I think about it more I don't think it is possible."
I'll try to see it. 



On Friday, June 7, 2013 3:18:32 AM UTC+5, Franck Derunes wrote:
Hi Naveed, you can get my app on googleplay its name is "slacker"
If you don't live in the US or Canada you won't be able to use it.
My test code is tightened to the source code, and I cannot disclose it. However I don't think this is related to the app itself.
My problem I think is more generic and is about the device system.

if you set your phone in airplane mode, when you reboot some phone will display a system popup. The idea would be to be able to get a handle on the the system popup to close it.
That said, more I think about it more I don't think it is possible.
Instead, I would have to do some external work like sending keystrokes via adb, eventually detect the popup via screenshot etc... it looks terrible to do...

Another popup that display also on a particular phone is a crash debug overlay popup. Same think, the only way to get ride of it is to manually press the ok button
Reply all
Reply to author
Forward
0 new messages