mehmet6parmak
mehmet6parmak

Reputation: 4857

How to identify multiple instances of Glance App Widget

I am trying to create a widget which shows information about a hardware device. There can be multiple of these devices and user will be able to add same widget for different devices. I am looking for a way to understand which device information should be shown inside GlanceAppWidget.Content() method. In Classical Android Widgets it was possible by checking appWidgetId passed to update() method. At Glance appWidgetId is hidden intentionally but I could not find an alternative solution.

Any suggestions?

Upvotes: 1

Views: 362

Answers (1)

Marcel
Marcel

Reputation: 2184

Probably you will use a configuration activity when the widget is placed to select the device right?

You can then use the GlanceID to store data in the state of that specific instance (updateAppWidgetState()). Then inside the Content you can retrieve the currentState to know which hardware device needs to be shown.

Upvotes: 1

Related Questions