文档管理中心
API参考MDM能力com.huawei.android.app.adminClass SummaryDeviceP2PManager

DeviceP2PManager

展开

Class Info

public class DeviceP2PManager

WiFi直连权限管理授权。

Public Method Summary

展开

Qualifier and Type

Method Name and Description

boolean

setWifiP2PDisabled(ComponentName who, boolean isDisabled)

允许/禁止WiFi直连功能。

boolean

isWifiP2PDisabled(ComponentName who)

获取WiFi直连状态。

Public Methods

setWifiP2PDisabled

Supported Devices

展开

Device Type

OS Version

手机、平板

EMUI 8.0及以上或HarmonyOS 2.0及以上

展开

Method

public boolean setWifiP2PDisabled(ComponentName who, boolean isDisabled)

允许/禁止WiFi直连功能。

注意:需要申请com.huawei.permission.sec.MDM_WIFI权限。

Parameters

展开

Name

Description

admin

调用该接口的APK的组件名称。

isDisabled

  • true:禁止使用WiFi直连。
  • false:允许使用WiFi直连。

Return

展开

Type

Description

boolean

  • true:配置成功。
  • false:配置失败。

Throws

展开

Name

Description

SecurityException

  • 此APK未经设备管理激活。
  • 无com.huawei.permission.sec.MDM_WIFI权限。
  • 此APK不属于当前用户。

isWifiP2PDisabled

Supported Devices

展开

Device Type

OS Version

手机、平板

EMUI 8.0及以上或HarmonyOS 2.0及以上

展开

Method

public boolean isWifiP2PDisabled(ComponentName who)

获取WiFi直连状态。

Parameters

展开

Name

Description

admin

调用该接口的组件名称,null表示获取全局禁用状态。

Return

展开

Type

Description

boolean

  • true:禁止使用WiFi直连。
  • false:允许使用WiFi直连。

Throws

展开

Name

Description

SecurityException

此APK未经设备管理激活。

在 API参考 中进行搜索
请输入您想要搜索的关键词