jmart
jmart

Reputation: 2931

App Widget problems on API 25

My app contains an App Widget composed of two parts: a header and a list view collection. Both parts are updated at the same time by pressing a button on the app.

On the widget update, I call updateAppWidget and notifyAppWidgetViewDataChanged to update the header and the collection respectively. So far, nothing out of the ordinary.

This has been working correctly from API 15 to API 24. But now, on API 25 (Previews 1 and 2 received OTA on a Nexus 5X), something weird happens: the widget randomly doesn't update when I press the button.

I've been debugging and the problem seems to come from calling notifyAppWidgetViewDataChanged immediately after updateAppWidget. When I put a delay between the two calls, the issue never happens.

It's as if those methods would clash on API 25. But as the source code for the preview hasn't been published yet, I cannot see what's happening inside.

Upvotes: 1

Views: 193

Answers (1)

jmart
jmart

Reputation: 2931

Well, the issue I opened on the issue tracker has been marked as 'FutureRelease', so it actually seems there was a problem with the Android implementation or the Google Launcher: https://code.google.com/p/android/issues/detail?id=228575

As I explained in a comment, the workaround that can be used in the meantime is adding a 1 second delay between the call to updateAppWidget and the call to notifyAppWidgetViewDataChanged (using a delayed runnable for the latter).

Upvotes: 1

Related Questions