Share via


DevicePolicyManager.SetDefaultSmsApplication(ComponentName, String) Method

Definition

Must be called by a device owner or a profile owner of an organization-owned managed profile to set the default SMS application.

[Android.Runtime.Register("setDefaultSmsApplication", "(Landroid/content/ComponentName;Ljava/lang/String;)V", "GetSetDefaultSmsApplication_Landroid_content_ComponentName_Ljava_lang_String_Handler", ApiSince=29)]
[Android.Runtime.RequiresPermission("android.permission.MANAGE_DEVICE_POLICY_DEFAULT_SMS")]
public virtual void SetDefaultSmsApplication (Android.Content.ComponentName? admin, string packageName);
[<Android.Runtime.Register("setDefaultSmsApplication", "(Landroid/content/ComponentName;Ljava/lang/String;)V", "GetSetDefaultSmsApplication_Landroid_content_ComponentName_Ljava_lang_String_Handler", ApiSince=29)>]
[<Android.Runtime.RequiresPermission("android.permission.MANAGE_DEVICE_POLICY_DEFAULT_SMS")>]
abstract member SetDefaultSmsApplication : Android.Content.ComponentName * string -> unit
override this.SetDefaultSmsApplication : Android.Content.ComponentName * string -> unit

Parameters

admin
ComponentName

Which DeviceAdminReceiver this request is associated with. Null if the caller is not a device admin.

packageName
String

The name of the package to set as the default SMS application.

Attributes

Remarks

Must be called by a device owner or a profile owner of an organization-owned managed profile to set the default SMS application.

This method can be called on the DevicePolicyManager instance, returned by #getParentProfileInstance(ComponentName), where the caller must be the profile owner of an organization-owned managed profile and the package must be a pre-installed system package. If called on the parent instance, then the default SMS application is set on the personal profile.

Starting from Android android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE, the profile owner of an organization-owned managed profile can also call this method directly (not on the parent profile instance) to set the default SMS application in the work profile. This is only meaningful when work profile telephony is enabled by #setManagedSubscriptionsPolicy.

Java documentation for android.app.admin.DevicePolicyManager.setDefaultSmsApplication(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