I'm trying to implement a sample iOS 8 today widget that includes a music player controls, the app is a basic music app with background-audio enabled.
I looked a lot around to find a way for notifying containing app, but I didn't find any!.
The scenario is basically, app is in suspended state and on a selected song/album (it might be paused on a certain song), then i need to display the names on the widget with play/stop/next buttons, etc.
Based on Apple's documentation, and this document which describes the usage scenarios: https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/ExtensibilityPG.pdf
It mentions that extensions shouldn't handle any long execution and stated specifically audio playback as a non-supported case as it needs to run outside the extension. but it didn't mention a way to trigger containing app in such scenario, it just mentioned NSURLSession technique which can handle big files downloads and wakeup app in background to call handleEventsForBackgroundUrlSession, and the App-Group share capabilities where both containing app and extension can access a shared data container. The only feasible solution that's stated is openURL solution which will forcibly bring the whole app to foreground.
I did setup a single App-Group for my demo and tried NSNotificationCenter's calls using a custom notification, by calling addObserver/postNotificationName on containing app and extension respectively, but it didn't work at all. I even tried to change NSUserDefaults of App-Group instead, but this doesn't fire in containing app's background too.
Here is some questions that might be related, but i didn't find an answer in it: (Sharing data between app extension and conainer app) --- (NSUserDefaultsDidChangeNotification not sent when app resumes from the background) --- (Set notifications from Today Extension Widget)
I thought that it might not be doable, but I just found an app called TapTunes that recently added a widget with similar features including all controls in the extension itself.
Thanks.