4

I noticed that Pasteboard, a clipboard app for iOS, can run Bonjour service in the background. I've no idea how they implement that, so I searched on the Internet and then found that it plays a silent sound file when in background. But it is not true now, because I can't see the app icon on the iPod management screen. How could they do that? Any ideas? Thank you in advance.

Kai.

nonamelive
  • 6,510
  • 8
  • 40
  • 47
  • What exactly are you trying to achieve - advertising your service via Bonjour, or something else? – Nick Bull Jun 24 '11 at 10:25
  • 1
    Wow, this is the most horrible thing I've ever heard. So the phone is playing a sound (doesn't matter if it's silent, the CPU is still processing it) in the background just to get clipboard functionality which already exists in the framework (UIPasteboard). – RyanR Jun 26 '11 at 01:03
  • Not to mention that Apple specifically says to **STOP** Bonjour services when entering the background as part of being a Responsible Background App. – Thompsonian May 02 '12 at 14:06
  • 2
    @NickBull,@RyanR,@Thompsonian -- Your comments are irrelevant - he asked for something very practical - perhaps he runs bonjour disocvery once every half an hour ??? Its on the limit of spam - perhaps its for jail borken device to home testing ? Or perhaps he is willing of taking the risk being rejected on the app store ? – James Roeiter Jul 29 '12 at 12:57
  • @JamesRoeiter I'm not sure how my comment is irrelevant - I was just asking for more information as to what he as trying to achieve. – Nick Bull Jul 29 '12 at 13:32

2 Answers2

1

Cancel any Bonjour-related services before being suspended. When your app moves to the background, and before it is suspended, it should unregister from Bonjour and close listening sockets associated with any network services. A suspended app cannot respond to incoming service requests anyway. Closing out those services prevents them from appearing to be available when they actually are not. If you do not close out Bonjour services yourself, the system closes out those services automatically when your app is suspended. https://developer.apple.com/library/archive/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html

RJ raj
  • 17
  • 5
1

You could, in theory, mark your application as needing to run in the background continuously (for VoIP, or mapping). I've done something this in a proof of concept and it worked great.

Alternatively, this document seems to document how to do networking in the background.

RyanR
  • 7,728
  • 1
  • 25
  • 39