We need access to the Screen instance of the browser, contacts, media app and phone (and possibly more).
Our current solution is to add a ApplicationMenuItem of type MENUITEM_SYSTEM.
Code:
ApplicationMenuItemRepository.getInstance().addMenuItem( ApplicationMenuItemRepository.MENUITEM_SYSTEM, new TestAppMenuItem() );
This will be shown in most apps on the device. When the user selects this menu item the run() method is called in the foreground app's space and we are able to get the Screen instance using
Code:
Ui.getUiEngine().getActiveScreen()
The problem with this solution is that whenever an app is exited and relaunched the user has to reselect the menu item so we regain access to the Screen instance.
One possible solution would be to use a background thread to monitor which app currently is in the foreground. As soon as one of the apps we are interested in is in the foreground (and we do not yet have access to the Screen instance) use EventInjector to post KeyPress events to open our ApplicationMenuItem.
The problem with this solution is that the menu will be visible for a short period of time. There will also be a chance that the user interferes this process.
We are searching for a solution that gives us the Screen instance on launch of an app without showing the menu or other major visible/interfereble activities on the screen. The solution has to work on OS 4.7+
This seems to be possible as the application StopTilt by Empower is able to do just that. It probably is doing some variation of the EventInjector solution. There is no menu visible. The only visible activity is a short focus change in the bottom toolbar on some apps on the Storm, which would be perfectly fine with us.
We are willing to pay $100,- to anyone who can give us a working sample code that solves this issue.