This question already has answers here:
Closed 11 years ago.
Want to close the third party application which are only in foreground by its processID not the super apps. Is there is any API to do that.
There is a way you can kill your app by System.exit(0);
Thanks in advance.
You cannot do this. API's provide you with control to your application only not to other apps. You can invoke another application but you cannot control it, exit or request background and foreground to it.
Related
This question already has answers here:
How do I get a background location update every n minutes in my iOS application?
(14 answers)
Closed 4 years ago.
I am trying to get the users' location updates and send it to the server every 1 minute in the background in iOS.
The app needs to keep track of the driver’s position continuously similar to Uber and report it to our server every minute.
I tried background fetch and background locations and it runs fine for 3 minutes and then stops.
How do we accomplish this? Please advise.
Thanks in advance!
you cant accomplish exactly that, since An app cannot just run in the BG for a continous interval. (Exception for Bluetooth (sometimes) and Audio or VOIP
look for another way to do it:
==> besides background refresh, def. look at significant location updates (!) [Getting user location when app is in background. IOS
This question already has answers here:
Local Notification on offline (Swift)
(2 answers)
Closed 4 years ago.
Iv'e been working on a topdown shooter game in Sprite-Kit using Swift and Xcode. I was wondering if there was a simple way to make a notification pop up if the user stops playing the app for a certain time (like 2 days for example.)
Also if I decide to add waiting in the future, can I make a notification pop up after and upgrade or something is complete? (this could also help other people viewing this post)
There is probably a similar way of doing these things but I would prefer if there was a simpler was as I am a bit new to Sprite-Kit and I don't want anything to complicated. A function would be nice if possible! :)
Thanks in advance!
If I am understanding you correctly sounds like the problem you are trying to solve has nothing to do with SpriteKit on it's own, but it's more related to triggering of a local or a push notification.
One way to achieve what you are trying to do is to make an object/module that it's sole responsibility is to count the application usage, when user opens the app or however you want to count that. You can trigger local notification that prompts the user that they haven't played the game for the past X days and every time the user uses the app you cancel the old notification and post a new one for the next X days.
Second option would be a server to manage the notifications via push notifications and your app will need to support push notification also tell the server whenever it's used so the server could notify if the app is not used for the past X days.
I have an iPhone app that I need to send to the background automatically. The app is defined with the VOIP key in its background modes so it should continue running when in background. I specifically need the app to keep running so calling exit(0) is no good.
The app will not be distributed via app store so using a private API is ok.
I have read about UIApplication terminate and UIApplication terminateWithSuccess but they don't seem to be available anymore
Already answered quite well here:
Suspend the application
As that poster wrote:
Quitting your application or sending it to the background programmatically is a violation of the [iOS Human Interface Guidelines][1], which usually doesn't bode well for getting through the review process:
Don’t Quit Programmatically
Never quit an iOS application
programmatically because people tend
to interpret this as a crash. However,
if external circumstances prevent your
application from functioning as
intended, you need to tell your users
about the situation and explain what
they can do about it. Depending on how
severe the application malfunction is,
you have two choices.
Display an attractive screen that describes the problem and suggests a
correction. A screen provides
feedback that reassures users that
there’s nothing wrong with your
application. It puts users in control,
letting them decide whether they want
to take corrective action and continue
using your application or press the
Home button and open a different
application
If only some of your application's features are not working, display
either a screen or an alert when
people activate the feature. Display
the alert only when people try to
access the feature that isn’t
functioning.
In Swift 3 Use below code, working charm
DispatchQueue.main.asyncAfter(deadline: .now()) {
UIApplication.shared.perform(#selector(NSXPCConnection.suspend))
}
While I agree with the other answer that you "shouldn't" exit programatically. There is a way to exit programatically.
*disclaimer - You shouldn't do this.
exit(0);
There is no way to put the application into the background without pressing the home button. If there is, you might want to add the jailbreak flag to your question and ask them.
For more, check this duplicate question, Proper way to exit application.
This question already has answers here:
Periodic iOS background location updates
(9 answers)
Closed 8 years ago.
I want to make an app that sends current GPS location to the server.
This app also needs to work in background mode.
Is it possible to make this kind of app?
Yes, that's indeed possible. You have to use the Core Location API for that.
Background code execution on iOS is quite tricky in general, but location updates are actually one of the few cases which make this possible. Your app receives the right to perform some operations after location updates are received, so you can use these operations to send the new data to the server.
This question already has an answer here:
Closed 11 years ago.
Possible Duplicate:
Create a mobile app that listens to incoming phone call events
I would like to be able to capture an 'incoming call' event in my application. I'd like to execute a task based on the incoming call details before handing the call over to the defaults call application.
From my research online, I understand that the application's applicationWillResignActive method is called when an incoming call occurs. However this puts the application in the background and I lose the fore-ground user interaction capability that I need. In the background, the best case scenario is to send a notification to the foreground.
Is there a way to attach an event handler deeper into the iOS framework to capture the event before the Apple's default call application. I do not need the application running during the call.
Thanks in advance. :)
The framwork has no (public) hooks for phone calls because they don't want apps to interfere with the behavior of iOS.
This is a classic example of a feature which fails the "what if everyone did this" test. Ergo, it's not going to be something that is allowed by the framework.
See http://blogs.msdn.com/b/oldnewthing/archive/2005/06/07/426294.aspx