Application lifecycle test when togging system menus: screen goes black when onvisibilityChange:hidden - cobalt

I am integrating youtube on cobalt 11. And now I'm testing the application lifecycle test.
I send the suspend event when I push the menu button (youtube goes to background)
I send the unpause event when I switch back to youtube. (youtube comes to foreground)
I send the deepLinke event after the unpause event
Sequence of events:
window.onfocus
window.onblur
....................?launch=remote
window.onfocus
..................:visible
onvisibilityChange:hidden
window.onblur
visible
When onvisibilityChange:hidden, youtube goes to the background; is that right?
This makes the screen turn black.
And why 1. window.onfocus and 2. window.onblur occur again after youtube has already resumed?

If you send the kSbEventTypeSuspend event, then Cobalt will assume that it is hidden and stop rendering to the display. If Cobalt is meant to remain visible, then do not send the kSbEventTypeSuspend event, instead you can send the kSbEventTypePause event. See the Cobalt lifecycle document for more information: https://cobalt.googlesource.com/cobalt/+/release_11/src/cobalt/doc/lifecycle.md .

Related

uiless action in Outlook add-in with displayDialog()

We are seeing a change in Outlook with one of actions (“Help”) that stopped working on the web client only.
This action simply calls a js that opens a web page in a displayDialog() but it’s uiless in the sense that there’s no pane.
The other action (“Sign”) works ok but it launches a pane that does this.
Both of them work fine on the rich client (at least the version I use).
I wonder if there has been in recent changes in the requirements or the way this works?
We’re not seeing any error messages, just nothing happens after the prompt saying that the add-in is doing something.
We did some initial testing and noticed that in chrome the dialog will sometimes appear briefly. Could you confirm that you are calling event.completed() in the eventhandler of EventType.DialogEventReceived? event.completed() must be called in the DialogEventReceived handler otherwise the dialog will be closed prematurely.
Office.context.ui.displayDialogAsync(url, dialogOptions, function(result) {
// In the callback, save the dialog object
dialog = result.value;
// Add an event handler for messages sent via messageParent
dialog.addEventHandler(Microsoft.Office.WebExtension.EventType.DialogMessageReceived, receiveMessage);
// Add an event handler for events from the platform (like closing the dialog, etc.)
dialog.addEventHandler(Microsoft.Office.WebExtension.EventType.DialogEventReceived, dialogClosed);
});

Subscribing to Apple events in Qt

Following the the code linked from here: Trap click event on dock icon using Qt on Mac, I tried to call the following method directly in my QApplication's constructor to receive notification of dock icon click events:
[[NSAppleEventManager sharedAppleEventManager]
setEventHandler: m_dockIconClickEventHandler
andSelector: #selector(handleDockClickEvent:withReplyEvent:)
forEventClass: kCoreEventClass
andEventID: kAEReopenApplication];
If I call it directly, I do not receive notifications of this event. However, if I call it using QTimer::singleShot with a delay of, say, 5000 ms, I receive the notifications just fine.
Also, according to the Qt documentation, "A QTimer with a timeout interval of 0 will time out as soon as all the events in the window system's event queue have been processed." So I tried 0 ms, but that didn't work. 1 or above seems to.
Why do I need to wait and what is a better way to handle this situation than delaying for n ms?
When your application exec() is called, Qt sets its own event handlers, so your handler is overriden.
You may use in your constructor
connect(this, SIGNAL(setupDockEventMonitor()), SLOT(onSetupDockEventMonitor()), Qt::QueuedConnection);
emit setupDockEventMonitor();
And in onSetupDockEventMonitor() do install this event handler.

The equivalent to onResume() in Windows Phone 7

I'm looking for some app life cycle help from the wp7 experts. My app has a refresh step in a specific page but I only want to launch this when the user brings the app to life from the background.
Note- The life cycle step I'm looking for isn't called when the page is init() only when I'm navigated (back) to or the user has taken a phone call and then re-opens the app (keeping the same page open)
Thank you in advance
what you are looking for is called Tombstoning and you can find a great article at http://wildermuth.com/2010/10/17/Architecting_WP7_-_Part_5_of_10_Tombstoning
The events are:
Launching (opened from tile)
Deactivated (user takes a call or something)
Activated (back from the call)
Closing (Leaves you app via the "Back" button)
You are looking for the Activated event. These are in your App.xaml.cs/vb file. Hook into the event, and update your data model. When your page is bound to that model it will get the data.
If you are not using MVVM, and can't really refresh from that event, you can do it using the PhoneApplicationService.Current.StartupMode property. It has two options Activate (what you are looking for) and Launch (loaded fresh from the tile). It would look something like
Init()
{
if (PhoneApplicationService.Current.StartupMode == StartupMode.Activate)
{
Refresh()
}
}

UILocalNotification and alertLaunchImage

Hmmm……
A question about UILocalNotification and the notificaton's alertLaunchImage.
My app uses UILocalNotifiaction(s) to get users' attention. As usual, an alert is presented with "Action" and "Close" buttons. When the user taps Action, the image specified by alertLaunchImage is presented. The alertLaunchImage is a screenshot of of one of the views of the app which is shown after the data is initialized when launched normally.
Here are the 3 cases when the notification is delivered:
App is running in foreground - no alert, no launchImage is shown as designed. No problems.
If my app is running in background when the notification is delivered, the launchImage works like a charm. No problems. The launchImage with no app-related data is shown and then the app fills up the data. This part works seamlessly.
However, if the app is not running when the notification is delivered, the sequence is confusing - or I missed something. The app gets launched and shows the alertLaunchImage instead of the Default image. Then is goes thru several other screens (as part of initialization and data processing) before the actual screen (live version of alertLaunchImage) is shown.
This can get very confusing to the user. My question comes in here. How can this be avoided?
R/-
Sam.!
you can try cleaning up the alert view settings in applicationWillTerminate:
According to the UIApplicationDelegate reference applicationWillTerminate::
"This method lets your application know
that it is about to be terminated and
purged from memory entirely. You
should use this method to perform any
final clean-up tasks for your
application, such as freeing shared
resources, saving user data,
invalidating timers, and storing
enough application state to
reconstitute your application’s
interface when it is relaunched"
HTH,
Oded
If your app is launched by a local notification, you will receive that notification in the options passed to -application:didFinishLaunchingWithOptions:. Based on that, you can write code that navigates to the correct screen without animations.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UILocalNotification *localNotification = [launchOptions valueForKey:UIApplicationLaunchOptionsLocalNotificationKey];
if (localNotification != nil) {
// startup by local notification
} else {
// normal startup
}
}

Show a Dialog Box from non event thread

I need to show a Dialog box, from an app started via an alternate entry point, when a push message arrives.
To do this I need to create an Application instance from the alternate entry point and listen for incoming push.
The problem is when I extend my application class from UiApplication, and call enterEventDispatcher() from the alternate entry point it shows an application icon in running applications forever.
I need to listen for push messages and alert user by a dialog without having an application icon.
So is there any way I can show a dialog from an alternate entry point without a UI event thread?
You can use global dialog. Just use this code.
synchronized (Application.getEventLock()) {
UiEngine ui = Ui.getUiEngine();
Screen screen = new Dialog(Dialog.D_OK, "Look out!!!", Dialog.OK,
Bitmap.getPredefinedBitmap(Bitmap.EXCLAMATION),
Manager.VERTICAL_SCROLL);
ui.pushGlobalScreen(screen, 1, UiEngine.GLOBAL_QUEUE);
}

Resources