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.
Related
How do I call an API inside fragment using kotlin-coroutines before exiting the application?
In fact, I want it to be called before leaving the application.
Android apps are not like regular desktop apps; the Android OS decides when to "close" them by calling onDestroy(). This can happen right after you press the system Back button, or hours later, or never.
A possible option is to use onPause() or onStop(), indicating when the user stops interacting with your fragment. But the user might start interacting with another fragment or activity you may have defined in your app.
Some apps listen to the back button press and ask for confirmation to "exit the app" before doing as much internal cleanup as possible. But it goes against the Android UX guidelines.
The window.applicationCache status is 2(Checking) when the issue occurs. I have some method called on the listener to some of the application cache change events. But when the issue occurs, I see none of the events getting fired.
Request to Manifest is also stuck forever when I inspect the network tab.
The device I am using is Ipad IOS-12.0.
In the success scenario, the status is 2(checking), then it raises noupdate event and subsequently the application cache status changes to 1(idle). This issue is intermittent and gets reproduced sometimes when I freshly launch the web app.
Since this feature is going to be deprecated by apple, the support hasn't come. you can do a workaround instead, have a listener on the checking event and may be after a setTimeout of 3-4 seconds you can perform your further calls.
Will keep this thread posted once an update comes.
I am new to windows app development. I am currently working on an Universal App using c# and XAML, which has 4 pages, first page being a welcome page. I have to check on other 3 pages (other than welcome page) that if the page is idle for last 2 minutes then I have to reload the welcome page, forcing used to start from the beginning. I did research on this on google, but couldn't find anything helpful. Hope someone from stack overflow community can direct in right direction.
Thanks,
Kevin
Is the welcome page for a login? If you are requiring the user to login to view the extra pages you will also have to handle when the app is in the background. In app.xaml.cs, subscribe to the corewindowvisibilitychanged event. Save a time stamp and now you can check how long the app has been in the background and navigate to the welcome page in the I launched event.
To implement an idle timer you should look at the I launched event where the root frame is created. Subscribe to the pointer moved event in the maimwindow, or use a base page for the similar three pages in your app. When pointer moves, start a dispatcher timer that will be your ticking time bomb for when the navigation occurs. If the pointer moved event happens again, call dispatcher timer.stop, null it out and start a new one. You may also want to subscribe to keyboard events too.
Don't forget to subscribe to pointer moved from the c#, so you can use the overload to handle all events, even when an originating source has already handled it. :)
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).
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.