worklight what is the event fired when the application exit - ibm-mobilefirst

Could you please help me to find the event or WL method fired when the worklight application exit ?
I have read the developer guide and may be i have miss it.
thanks.
regards,
jack

IBM Worklight ships with Apache Cordova, you can try to use Cordova's Event API. Specifically the pause event.
This is an event that fires when a Cordova application is put into the background.
//Add the event listener
function wlCommonInit() {
document.addEventListener("pause", onPause, false);
}
// Handle the pause event
function onPause() {
//...
}

When you quit the app, the app quits. Nothing else happens.
Otherwise, you'll need to edit your question and be clearer.
Do you mean:
when the app quits
how to programmatically quit the app
what happens when the app moves to the background
something else...?
Availability:
Android
Windows Phone 7.5
Windows Phone 8
Edit: based on the comment to this answer, you want to use WL.App.overrideBackButton, so that once tapping on the physical Back button instead of quitting the app you could display a WL.SimpleDialog or alert or whatever else you want to do. An 'OK' button could then trigger WL.App.close to quit the application (and a 'Cancel' button that will do nothing, to keep the user in the app).

Related

WP8: Can this (PhoneApplicationService.RunningInBackground ) be used outside of location based app?

From this link below, it seems that your app can still get event when app is switched to background. But it seems it is used only for location based app. Can normal app do that? I had tried to declare ID_CAP_LOCATION but still Application_RunningInBackground not get called when switch to background.
http://msdn.microsoft.com/en-us/library/windowsphone/develop/microsoft.phone.shell.phoneapplicationservice.runninginbackground(v=vs.105).aspx
The app doesn't execute in background, unless it is continously tracking the location.
This section lists the conditions under which the operating system
will deactivate an app running in the background....
The app stops actively tracking location. An app stops tracking location by removing event handlers for the PositionChanged and
StatusChanged events of the Geolocator class or by calling the Stop()
method of the GeoCoordinateWatcher class.
Source: Running location-tracking apps in the background for Windows Phone 8
You will find complete info of how to run apps in background here:
How to run location-tracking apps in the background for Windows Phone 8

How to find out user is at desktop instead of start screen or another store app UI at Windows 8

As we know, at windows 8 if user is at start screen or another store app (metro app) UI, the dialog at the desktop won't be visible to user. We are adding some toast notification capability at our application by following Sending toast notifications from desktop apps sample. I am able to get it working. However if user is already at the desktop, we don't want to send out the toast notification. So it would mean that we need to be able to detect if user is current at desktop or not. Somehow I didn't find any API by searching on internet. Could someone let me know how to do so? Thanks very much.
A toast notification can't know in what context the user is located, so this is not possible.

get url event on app open in objective c (Mac OSX)

I'm writing a very lightweight app for OSX 10.6+ which will respond to a user clicking on a URL, pass that URL to another application via TCP and then exit.
So far it has registered fine to launch when a user clicks the custom url scheme. However the event seems to get lost if the app is not already running. So the users clicks the link, the app loads, but nothing happens. Once the app is running, if the user clicks the link then it grabs the event and processes it as normal.
What do I need to do to catch that initial event that causes the app to open in the first place?
Currently I'm creating the NSAppleEventManager in the applicationDidFinishLaunching method, and this works for all events created AFTER the initial load, just not for the one that actually opened the app itself.
Any advice would be brilliant!
Thanks!
You should be creating your AppleEvent handlers in -applicationWillFinishLaunching: instead.
The idea is to have your handlers ready to go before your application begins processing AppleEvents.

Force WinRT app to snapped view

For one of my apps I'd like to send the app to snapped view after tapping a button. As far as I know there's no public API available to send a running application to snapped view. Did anyone find a workaround to do this?
Somehow it should be possible since you're able to do it in Windows 8 itself, and snap one of the running apps.
Update: Being able to trigger a Win+. might do the same trick, but the SendKeys API isn't available in WinRT either.
There is no way to force an application into snapped mode - it has to be a user initiated action.
An application can request to be unsnapped through:
Windows.UI.ViewManagement.ApplicationView.TryUnsnap();
Which tries to push the app into fill mode.
Windows 10 has a ApplicationView.TryResizeView method
So... to summarize the interesting WinRT journey:
Windows 8
Has a a 'Snapped' mode that a only a user can initiate. the developer can try to unsnap with the TryUnsnap method
Windows 8.1
Does not have Snapped mode, and TryUnsnap is deprecated. The dev can still listen for window size changes and know if the app view is in a smaller size as before.
Windows 10
Introduced the ApplicationView.TryResizeView method, where the dev can try to resize. Window size changed event is still there.
ApplicationView.GetForCurrentView().TryResizeView(new size(width, height)));

Screen events in Caliburn Micro (showing message box at startup)

I want to show message box on app start.
I used OnActivated method of my first screen to show modal dialog.
It worked fine. And the case when user deactivated app without pressing Ok worked fine. After activating app again new messageBox was shown. Perfect.
But issue was that app wasn't completely initialized and OS killed app after 5 or 10 sec of waiting.
I tried to use OnViewLoaded event. But this event doesn't fire every time screen is navigatedTo.
Can i somehow get some event fired every time form is navigated to but bit later (like OnViewLoaded event) ?
OR
At what point OS stops its timeout timer ?
As i see at OnNavigated it is forbidden to show modal dialogs, but at Loaded handler - already possible
Sorry for quick self-answer. Suddenly discovered a small hack.
I've ovverriden OnNavigatedTo method like that
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
base.OnNavigatedTo(e);
base.InvalidateMeasure();
}
And i show MessageBox at Caliburns OnViewReady method.
As a result
app is not killed by OS for taking >10 sec of load time.
message box is re-shown after deactivate-dorment-activate cycle.