Blackberry Application exit callback - blackberry

I would like my application to requestBackground when the user exits the application. Is there a callback for when the user exits the application so that I may requestBackground?

Yes.
Screens receive an onClose() call before they are closed. When the first screen on the stack (the first screen that is started when your application starts) closes, the application is terminated.
Override the onClose() method of the first screen on the UI stack in your application, and request background.

Related

Detect when app killed by user in background state iOS

I am working in a chat application where I need to show user status (offline/online).
When my app is in foreground and background then I need to show user as online (managing by VoIP).
But when the user kill the app then it should go to offline.
I have to maintain a flag to show offline which I am managing in delegate function applicationWillTerminate but this function only called when app is in foreground state and user kill it by pressing double tap home button and swipe up.
This function does not get called when app is in background state. I mean simply press home by single tap (app will go in background) then again double tap to swipe up.
Is there any function where I get 100% call either app is in background/foreground state and user kill the app?
Is there any function where I get 100% call either app is in background/foreground state and user kill the app?
No. Just the opposite. If your app is terminated when already in the background, if it is suspended (ie not running in the background due to special entitlement), it is 100% certain you will get no event. You cannot. You are suspended and not running. The app dies in its sleep.
No, As per Apple Document
https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623111-applicationwillterminate?language=objc
For apps that support background execution, this method is generally not called when the user quits the app because the app simply moves to the background in that case.
What you can do execute a method(which hit an API for keeping status online) after few seconds(whatever you find suitable time) when you app goes in Background, If method is calling successfully after that specific seconds then user stay online, if its not call after specified second then server update its status to offline. So It require both server and client handling.

How a application is launched from user tapping on AppIcon to application Launch iOS?(At OS level)

Can anyone tell how the OS invoke the application in iOS.
User Taps an icon --> UIApplicationMain() function called --->Did finish launching called.
Is this the sequence? I tried to search but haven't got any clear explanation.
When your app is launched, it moves from the not running state to the active or background state, transitioning briefly through the inactive state. As part of the launch cycle, the system creates a process and main thread for your app and calls your app’s main function on that main thread. The default main function that comes with your Xcode project promptly hands control over to the UIKit framework, which does most of the work in initializing your app and preparing it to run.
Figure shows the sequence of events that occurs when an app is launched into the foreground, including the app delegate methods that are called.
For more Details look this: https://developer.apple.com/library/content/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/StrategiesforHandlingAppStateTransitions/StrategiesforHandlingAppStateTransitions.html

Speakerbox IOS callkit UI hides itself after call receive

After accepting incoming call on speakerbox iOS, the UI which shows caller name and timer on native call controller goes back of the app. Is there a way to take that to the front form where user can disconnect, mute and see the timer.
When your app is in the foreground, it is responsible for showing a UI for the call (for example, what does your app do on iOS 9?). So by bringing your app to the foreground, that is enough.

Determine the app state on pressing home button twice with app running

I would like to know as to what the application state would be on hitting the iphone "Home" button twice with the application running.
The scenario is something like below:
My iOS app is running on the foreground
With the application running hit the home button twice to bring up the multi-tasking taskbar (obviously my app is not listed here because it's not a recently used app and is still running in the foreground)
Now press anywhere outside the taskbar (i.e in the application) and app will be back in focus again
My questions:
What state would be app be on performing above step #2? Would it enter background or still in foreground? What method would get triggered here?
On performing step #3, would the app re-enter foreground from background? Again what method would get triggered here?
Any hints/suggestions would be very helpful.
The application is about to move from active to inactive state, so it's still in-between. You should be able to use -applicationWillResignActive: in your UIApplicationDelegate.
After returning to the application, the application becomes active again thus receives a -applicationDidBecomeActive: on your UIApplicationDelegate.

Show popup while app is in background

I am developing an application where I want to show a popup screen at a regular frequency selected by the user, even if my application is closed.
I am able to show a popup screen in regular intervals when my application is in the foreground. But I am not able to show a popup screen when my application is in the background.
I tried UIApplication.requestBackground() method, which invokes Application.deactivate() method, and on that method I am calling a timer. But it is not giving me any output, not even exceptions.
You want to use UiApplication.pushGlobalScreen() to get a popup to appear when your app is in the background.

Resources