1

I have a problem guys.I have requirement where my app should detect if the device is idle without any application running or without any user interaction from my application or at-least to know if the device is in home screen.What i am asking may be stupid but this is my requirement.Is there a way to achieve this. Help me

rmaddy
  • 314,917
  • 42
  • 532
  • 579
vishnuvarthan
  • 492
  • 1
  • 6
  • 23
  • 1
    please check: http://stackoverflow.com/questions/273450/iphone-detecting-user-inactivity-idle-time-since-last-screen-touch – Nitin Gohel Aug 19 '14 at 05:17
  • 1
    I don't think it's possible. If this is a requirement then you can't ship your app. Why do you need it? – Abhi Beckert Aug 19 '14 at 05:32
  • @AbhiBeckert My app is an enterprise app. I install my app over air on multiple devices.I have to make sure the device is idle,only then I can update it or install it. – vishnuvarthan Aug 19 '14 at 07:08
  • @NitinGohel your reference link shows how to detect user interaction.this helps but what if an app is running without any user interaction then how to detect that.any suggestion ? – vishnuvarthan Aug 19 '14 at 07:13
  • i dont think apple provide any specific code. You can handle within your app as i given link. – Nitin Gohel Aug 19 '14 at 07:17
  • @NitinGohel I know that.The link only allows you to handle user interactions,but that is only a part of my requirement – vishnuvarthan Aug 19 '14 at 08:26

1 Answers1

0

OK, enterprise apps are different. I think this can be done.

Have your app record whenever it's launched by the user (the app delegate receives events when the app enters/exits the foreground).

Then setup a "local push notification" several times a day that launches your app in the background and checks the log to see if the last entry is a "did leave".

If it is, then load up the URL to your itms services URL to install the new version of the app.

Abhi Beckert
  • 32,787
  • 12
  • 83
  • 110