Sdílet prostřednictvím


AppWidgetManager.UpdateAppWidgetProviderInfo(ComponentName, String) Method

Definition

Updates the info for the supplied AppWidget provider.

[Android.Runtime.Register("updateAppWidgetProviderInfo", "(Landroid/content/ComponentName;Ljava/lang/String;)V", "GetUpdateAppWidgetProviderInfo_Landroid_content_ComponentName_Ljava_lang_String_Handler", ApiSince=28)]
public virtual void UpdateAppWidgetProviderInfo (Android.Content.ComponentName? provider, string? metaDataKey);
[<Android.Runtime.Register("updateAppWidgetProviderInfo", "(Landroid/content/ComponentName;Ljava/lang/String;)V", "GetUpdateAppWidgetProviderInfo_Landroid_content_ComponentName_Ljava_lang_String_Handler", ApiSince=28)>]
abstract member UpdateAppWidgetProviderInfo : Android.Content.ComponentName * string -> unit
override this.UpdateAppWidgetProviderInfo : Android.Content.ComponentName * string -> unit

Parameters

provider
ComponentName

ComponentName for the android.content.BroadcastReceiver BroadcastReceiver provider for your AppWidget.

metaDataKey
String

key for the meta-data tag pointing to the new provider info. Use null to reset any previously set info.

Attributes

Remarks

Updates the info for the supplied AppWidget provider. Apps can use this to change the default behavior of the widget based on the state of the app (for e.g., if the user is logged in or not). Calling this API completely replaces the previous definition.

The manifest entry of the provider should contain an additional meta-data tag similar to #META_DATA_APPWIDGET_PROVIDER which should point to any alternative definitions for the provider.

This is persisted across device reboots and app updates. If this meta-data key is not present in the manifest entry, the info reverts to default.

Java documentation for android.appwidget.AppWidgetManager.updateAppWidgetProviderInfo(android.content.ComponentName, java.lang.String).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to