App that stays in front of other apps
I need to write an app for testing purposes, which shall stay in 开发者_如何学Pythonforeground regardless which other application is currently activated. That means i need to allocate a small area of the screen that shall be usable for my app. Does somebody know a way how to achieve this?
Sounds like you want to to create something like statusbar. I'm not sure if you can do that without using some internal android API(for which you'd need to recompile android and build your own custom ROM).
Now you can look at what android does when it creates status bar here http://www.google.com/codesearch#uX1GffpyOZk/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarService.java check the addStatusBarView method. There some internal stuff there like WindowManagerImpl. You might be able to achieve something like this by using dialog or regular activity and using getWindow() to get its window and setFlags to mess with its flags in order to make them behave more like status bar. I'm not sure if this would give any results..
If you don't have a lot of info to display maybe it would be much easier to use notification in the status bar..
Look at this thread it looks like a similar problem was addressed there.
精彩评论