0

Hi I press the home button then my app is in the background. Can I perform a method in my app when the user took screenshot? In google plus, it seems that the autoupload works when you click the app again not after you took a photo. Thanks!

Ted
  • 22,696
  • 11
  • 95
  • 109
  • possible duplicate of [Possible to detect if a user is pressing the screen capture buttons on iOS??](http://stackoverflow.com/questions/9097617/possible-to-detect-if-a-user-is-pressing-the-screen-capture-buttons-on-ios) – βhargavḯ Nov 27 '13 at 06:23

1 Answers1

1

You can be notified when the user has taken a screenshot by listening for the notification:

UIApplicationUserDidTakeScreenshotNotification

Apple Reference here.

Tarek Hallak
  • 18,422
  • 7
  • 59
  • 68
ksimons
  • 3,797
  • 17
  • 17
  • UIApplicationUserDidTakeScreenshotNotification can we use this while the app is in the background? And if the app receives this notification, can it upload while on the background? – Ted Dec 10 '13 at 08:40
  • @Jen No, I don't believe you'll get this notification if you're not the foreground app, though I've never tried. Try it out for yourself, shouldn't take but a moment. Regarding uploading in the background, it's possible to start an upload when you're in the foreground and continue once you've been backgrounded: http://stackoverflow.com/questions/15788106/continue-uploading-process-in-background-ios – ksimons Dec 10 '13 at 20:20
  • Yeah thats what i think too. Just thought that someone might have done this already haha. Thanks ksimons! – Ted Dec 10 '13 at 23:42
  • By the way, can we use push notifications or a server to tell our app to upload something while it is running in the background? – Ted Dec 10 '13 at 23:48