What i want : When my app goes in background and user opens any other app then i should be notified that some other app is opened.
How i am trying to do : Run a thread in background say for 2 hrs, this thread will check what other app is opened.This does not happens always , only when certain condition is met.
How i am trying to achieve this : i am using
UIBackgroundTaskIdentifier & beginBackgroundTaskWithExpirationHandler
The thread runs endlessly but i dont think its the right way coz apple suggests it should not be done, threads gets killed after 10 mins, however this funda is woking fine for me still i wanna use more secure way to achieve this.
I also checked background modes and some new modes available in ios 7.0 but still cannot find which mode to be used to achieve this [for a particular session/condition, when app goes in background and remains there for 2 hrs i get notification that some other app is opened instead of homescreen].
Any idea how to achieve this. Just wanna know how to achieve the background work to receive notifications that some other app is opened.