Can we close any other applicaton running in background from our application.
Want functionality just similar to Task manager.
Is it possible? Any hint.
Thanx in advance
"Victim" application should implement GlobalEventListener, and "killer" application should send a global event for the "victim" application. When "victim" app receives the specific event it closes.
If you want to close not your application, there is no way to do that. It just does not know that you want to close it.
Related
I'm developing an application with SWIFT, which sends the location of cars through a REST call. When the application goes to background after 7 minutes, the loop that is sending the location stops being sent.
Does anyone know of any way to keep the loop running?
In the documentation it informs that this is a normal behavior .. but it needs to continue making this call of REST.
You may need to enable "iOS background data transfer". Check here an article on this topic: https://topologyeyewear.github.io/engineering-blog/2017/11/20/background_transfer/
Good luck!
I have a radio application. The application have a option, like alarm. You set a hour and the application will become active.
Is a way to do this? Thanks
No, this is not possible. You can play a sound at a specific time, even if your app is in the background, or you can send a notification (local or remote) to tell the user that he/she should open the app.
No. You could try creating a UILocalNotification which on action would activate your app.
No, it's not possible to open application automatically on any specific time.
I need to achieve this: I have an app, which wants to keep track of location of family members. Since I don't want to keep the GPS running all the time, I was thinking I could just send a request from server, when some family member wants to know my location.
But I ran into some problems:
I can't use PUSH Notifications, because those need to be confirmed (tapped on) and only after that the app knows something happened. (This would not be great, since kids probably wouldn't tap the push notifications)
The other option would be to keep the app running in the background, checking server for any news and if it found some request on server only then start the GPS tracking and upload coordinates to server. This sounds a bit better, but also battery draining.
Did anyone already try this? Is there any better way to this problem?
Thanks for any reactions! :)
Yes, I think the only option for you left is run Location Services in background.
For this in Plist set for Required background modes to App registers for location updates. This will enable you to send location updates as you want.
But note that this will only work when application is running or in background, and it will not run when you application is closed. If user closes your application, then you can fire push notification if you done get any updates from device.
Also, note that you need to mention in description of your application, that Application uses location services which will drain your battery, otherwise your application will not be approved.
Hope this info helps you..
We had similar problem in our application. We followed the approach that keep listening to push notification port, whenever we receive any notification, then check if it's for our application and then react accordingly.
We can have listening to port on long time to save battery draining.
Sorry cannot share any of the code with you, but I hope this might be some help.
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.
I have a Problem with my Sony SmartWatch App. I've developed a widget with control, but after the App is installed by users on the device the scheduled refresh task of the widget starts automatically. This means the refresh task is running all the time, even if the user did not turn on SmartWatch Display or start the widget. This drains the battery. If I go to the widget screen and then turn the display from off, the scheduled Task stops like expected. But if I don't do this the task is running and running and running....
How can I detect if the Display is on and the widget is running?
Thank you very much!
P.S.: It makes no difference if the "Activate Widget" preference is checked or not....
EDIT: I've found out that the widget sourcecode does not fire if I uncheck the "Display as Widget" Checkbox in preferences. This means if the refresh schedule is running and I uncheck this box, the onDestroy is never called and so the cancel schedule also not....
Thank you - I think you have uncovered a bad behavior by the SmartWatch host application, or in other terms, a bug.
When installed, the host application sends a START_REFRESH_IMAGE_REQUEST to be able to cache information about the widget. However, it does not call STOP_REFRESH_IMAGE_REQUEST, which it probably should. This needs be investigated.
While we are investigating this bad behavior, you should try to find a workaround to solve the problem. E.g. you could have a global static variable, or a SharedPreference, that is used to track when the first START_REFRESH-signal is sent, and thus be able to stop the refresh cycle.
Thanks again, and sorry.
I will post again in this thread when I know more about fixing the problem.