I'm trying to build a widget that displays Android calendar info. The data is pulled on startup and to keep the widget synced, I'd like to listen to whenever the calendar is updated, and perform updates only then.
I saw an approach of using a system broadcast receiver like the following, however this is not working. No updates are being seen by this receiver.
<receiver android:name=".NativeEventChangeReceiver" android:exported="false">
<intent-filter>
<action android:name="android.intent.action.PROVIDER_CHANGED" />
<data android:scheme="content" />
<data android:host="com.android.calendar" />
</intent-filter>
</receiver>
The other approach that seems viable is registering a ContentObserver, but this means there would be an additional Service running continuously which I'd prefer to avoid.
What is the best practice for retrieving calendar data on Android only when the data has been updated?