11-03-2012 06:03 AM - edited 11-03-2012 06:04 AM
Hello everyone, I have an application which is autorun on startup. I need that the application stays on foreground for 5 seconds as soon as the system starts. How can I do this? Please help.
Solved! Go to Solution.
11-03-2012 08:49 AM
Thanks for your reply Peter. But, it won't work in my case. I need my UiApplication to start on device startup and stay in foreground for 5 seconds atleast. I need the user to do some keypresses in those 5 seconds which I manipulate through KeyListener. I am not able to do this. I have tried Thread.sleep(5000) but it also doesn't work.
11-03-2012 10:18 AM - last edited on 11-05-2012 05:21 AM by BelmaHFL
Can you provide a little more detail on precisely which parts of this are causing your problems. For example, is it the starting, the retaining a screen for 5 seconds, or why you need to capture the key strokes, or if you expect the user to have some visible indication that your application is in the foreground.
The start on start-up should be easy, but you need to take note of this:
Then the best think to do, is probably NOT to push your UiApplication t the front. Instead keep it in the background and push a GlobalScreen. Use the GlobalScreen to capture the keystrokes you want.
Regarding keeping this active for more than 5 seconds, with your GlobalScreen, I don't see the problem in being able to do this.
But I also don't really understand why you would want t do this, so can't really understand your use case and requirements, which doesn't help trying to figure this out. Perhaps you can explain what you are trying to achieve, as well as explaining which parts are giving you grief.
11-05-2012 01:13 AM
Thanks, the link was really helpful. I didn't know this before.
I need to take some input from the user before the application can perform its functions. For this I need an interval of 5 seconds. My problem is that I can't have my applicaion stay in foreground for 5 seconds.
I will try it with the GlobalScreen now. Thanks you for your reply.
11-05-2012 02:32 AM
You can also use some splash screen or some some Activity indicator at the starting of App.
If you will lock the App for 5 seconds at the start, it will not good for App. So add any Splash screen or Activity loader at the starting of App.
Please press like if you satisfies with the solution.
11-05-2012 04:19 AM
Sorry I'm still not clear on what you are trying to do or what you are having difficulty with. To make further comment I think we need to know more about your requirement. For example, you say
a) "I need to take some input from the user before the application can perform its functions"
Does this need to be at startup? Or startup of your application? What happens if you do not get this input?
b) "For this I need an interval of 5 seconds"
Why 5 and not 6 or 4. What should the user see while this is going on?
Also, how does the user know that they have to input this information and why would they want to do it?
@ankitagrawal. I am not clear on what you are trying to say here or why a splash/loading screen would be helpful. Also how you can make sure a splash/loading screen stays visible, and what do you mean by locking the application. Perhaps you could review the question and your answer and explain it better? Thanks
11-08-2012 12:22 AM
Sorry for late reply. And thanks for your time peter. I have kind of accompplished what I was trying to do with Thread.sleep() and editing my code. But I'm still not happy about the code.
Actually, I need 3 key presses as a password from the user to begin my app to further start functioning. If the password is incorrect, it should close my app. And I need to do that when the device starts up.
I think 5 seconds is enough for the user, that is why I said 5 seconds. No other special reason. I think I have made myself clear now.
11-08-2012 04:07 AM
If this is solved can you mark it appropriately. Instructions in Help link at top.
If not, then given your requirements, I would go with a Global Dialog screen and a DialogCloseListener, that will kill your app if the response is not correct. .