How to resume Cordova iOS app - ios

I am using iOS cordova-2.1.0,jqueryMobile and html5.I have added feature of phone call inside the app,when I click on 'Phone Call' link it prompts me to call or cancel.If I choose cancel button then app resumes,but if I choose call then after ending call app does not resumes its restarts.I have added UIApplicationExitsOnSuspend in appName.plist because I want to exit the app when it goes into background after pressing the home button.

the application goes to background when a call is triggered. if the application does not support suspend/resume feature just like yours "UIApplicationExitsOnSuspend", it is same as pressing HOME button for the application and hence the application does not resume.
either you have to remove this key and let the application resume or there is no other choice

Related

ApplicationShortcuts, is there any way to not open the app and only execute some actions such as Play/Pause?

I have an audio app and I want to control play/pause with ApplicationShortcutItem directly, but I don't want to open the app.
Is it possible?
It is not possible to leave an app in the background when choosing a Home screen quick action.
From the documentation of UIApplicationShortcutItem:
When a user chooses one of your Home screen quick actions, the system launches or resumes your app and UIKit calls the application(_:performActionFor:completionHandler:) method in your app delegate.

Detecting home button press on iOS?

Is there any way to detect if the user has pressed the home button on iOS? Obviously if the app is running normally the app delegate methods gets called, but if the device is locked to an app (through Guided Access or an MDM-server) so the app doesn't quit when you push the home button - is there then any way to know if the user pushed it?
My initial thought was to listen for notifications, but I can't seem to see any generated by pressing the home button.
short:
no not on a stock idevice
longer:
on a stock device your best bet is UIApplicationDidEnterBackgroundNotification (Posted when the app enters the background.)
there is no dedicated way to listen for presses to the home button though, so this won't work for GuidedAccess either

How to stop the app in background when user settings changed

I've implemented the settings.bundle to give the user the choice of selecting one of three possible languages. When pressing the Home-button to quit the app remains in background. If I change now in the settings the language for my app and touch the app-icon the app remains in the last language. I have to stop the app by double-clicking the Home-button and wipe it off. With the following restart the app launches in the desired language. How can I do that "stop" done in the background if the user-settings are changed? Or how can I force to reload the views when entering foreground?

Home button does not terminate program in simulator

I'm new to programming and have been using this site for a while now but everything I've had to ask has been answered somewhere but I couldn't find an answer to this:
I am programming a game for the Apple AppStore using Xcode and test it on the iOS Simulator. When I "Build and Run the current Scheme" (the play button on Xcode), I can test out my game, and when I am done I can hit the "Stop the running scheme or application" (the stop button on Xcode), and of course it ends my game.
However, on the iOS Simulator, an icon for my game appears on the main screen along with apple programs such as "safari". When I click this, it enters my game and I can play it fine. However when I click the "Home button" or the "lock button" and re-enter my game, the game is continuing from where I left off; I want the game to end so when I re-enter my game it goes back to its original state.
I was wondering if anyone had a solution to this problem? Thank you in advance for your time and help!
When you hit the Home button on your device or simulator, you are simply "backgrounding" the app. That is, you are not quitting or killing the application, you are simply sending it to an 'idle' sort of state.
iOS will automatically kill/quit applications that are in the background if it needs memory, but what you are probably seeing is that you background your app (hit the Home button), and then you tap the game's icon to open it again. This will resume the game where it left off.
When you hit the square (stop) button in Xcode, you are killing/quitting your application. If you run your application from the simulator (not by hitting the play button in Xcode) and you want to quit the app entirely, hit the Home button twice or use the Command+Shift+H shortcut twice to show the app switcher, and then just drag your application's card up.
This will quit the app and make it launch from scratch when you tap the icon in the home screen again.
Return your game to the original state using this method in the AppDelegate.m:
- (void)applicationWillResignActive:(UIApplication *)application
{
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
Now when you hit the home button and start the app next time it will be in the state you left it (however you want this to be).

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.

Resources