I have an appwidget and i want to set an onClick Pending Intent. I would like this PendingIntent to be set from the UpdateService class, not the WidgetProvider class. I've unsuccessfully tried to do it in the same way as i would from the WidgetProvider class.

Edit 2: The issue that caused me to post this question turned out to be unrelated. But having confirmation that it is possible to do it, i kept trying and found that my problem was caused by the onClick appwidget layout item being obscured by higher layers in the appwidget layout.
(edit 1 removed code as it was irrelevant.)

有帮助吗?

解决方案

Step #1: Have UpdateService obtain an instance of AppWidgetManager, via the static getInstance() method.

Step #2: Call updateAppWidget() on the AppWidgetManager.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top