Need a way to tell if a Today Widget is running in the background or visible in the Notification Center

Originator:greg
Number:rdar://27434852 Date Originated:07/19/2016
Status:Open Resolved:
Product:iOS SDK Product Version:9.3.2
Classification:Enhancement Reproducible:Always
 
I have an iOS Today Widget that makes an expensive API call (expensive as in the more it is called, the more I pay money). If I implement widgetPerformUpdateWithCompletionHandler in my widget, then the widget can be updated in the background several times a day without the user ever looking at their Notification Center.

In an app, there is a key-value-pair in the options dictionary of application:didFinishLaunchingWithOptions that tells you if the app is launching the background or not, but there isn't anything similar in a widget that I can find. There is also the call to get the applicationState in UIApplication, which also isn't available in a widget.

So I require a way to know if the widget is being initialized and loaded in the background from the system or if it is being loaded for display in the Notification Center to be able to not make expensive calls that aren't necessary if the user isn't actively looking at the widget while still being able to have the widget update itself in the background for the less expensive calls.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!