1

I am trying to do a simple podcast-like widget for iOS 8. Things works fine, audio works... except that when the screen sleep, the audio stops.

Can Today Extension do background audio? Or multitasking in general?

Lim Thye Chean
  • 8,704
  • 9
  • 49
  • 88

2 Answers2

1

No. Today Widget is destroyed when it goes out of view (as evidenced by viewDidDisappear).. so sound can only be enabled when the widget is physically in view.

Edit: Nope it is linked to the host app that runs it. As detailed in Apple documentation, an extension is a specialized binary that is delivered through a containing app. The containing app is only used for delivery and the extension runs independently of it. This notwithstanding, an iOS containing app is required to effectively provide some functionality in addition to the extension. On OS X such requirement is relaxed and a containing app is not required to provide any additional functionality.

As mentioned, an extension life cycle is completely unrelated to its containing app's and it comprises 4 steps:

User chooses an app extension. System launches it. App extension runs. System kills app extension.

http://www.infoq.com/news/2014/07/apple-ios8-app-extensions

ktzhang
  • 4,069
  • 2
  • 19
  • 18
  • Isn't this the same as an app which goes out of view? The app can registered to background audio, part of multitasking. – Lim Thye Chean Aug 06 '14 at 01:07
  • Nope it is linked to the host app that runs it. – ktzhang Aug 06 '14 at 05:34
  • Does not understand your last statement. I mean if a normal app can do background audio, can a Today Extension do the same as I did not find any documentation that this cannot be done? – Lim Thye Chean Aug 06 '14 at 05:53
  • Basically an extension is linked to the app that is running it (eg. Email app or whatever app the person is on) and thus cannot have any background processes running. – ktzhang Aug 06 '14 at 16:57
0

As @ktzhang mentioned, background audio isn't available to extensions.

However, some limited multitasking is possible, the documentation says you "can set up a background URL upload or download task" in an extension.

koosmann
  • 61
  • 3