as

Settings
Sign out
Notifications
Alexa
亚马逊应用商店
AWS
文档
Support
Contact Us
My Cases
新手入门
设计和开发
应用发布
参考
支持

IParentalControlsPreferenceWriter

IParentalControlsPreferenceWriter

用于编写PCON首选项的接口,包括整体启用状态以及各种子功能的启用(例如PIN保护购买)。当禁用PCON (isEnabled == false) 时,所有子功能都将被停用。要查询每个首选项的当前状态,请参阅IParentalControlsPreferenceReaderV2。

所有家长监护首选项均为设备本地状态。

注意

PIN管理是账户级别的设置,由IPinManagement管理。

扩展自

方法

invokePconEnablementWorkflow()

invokePconEnablementWorkflow(enable): Promise<IEnablementWorkflowResponse>

参数

enable

boolean

true时表示启用PCON,为false时表示禁用

返回值

Promise<IEnablementWorkflowResponse>

简述

启用/禁用PCON,由PIN验证模态对话框设置限制以征得家长同意。

此方法可启用或禁用设备的家长监护服务。更改启用状态(任一方向)都需要管理员(“家长”)的同意,因此调用此方法将以不可避免的模态对话框的形式要求用户进行PIN验证;也就是说,用户必须成功验证其PIN或取消验证。尝试避开PIN验证(例如通过按返回或遥控器上的提供者快捷方式)将隐式地取消PIN验证。

如果尚未建立PIN,则此方法将改为调用首次设置工作流程。

一旦PCON解析了请求,就会调用{@ref gateContentPlaybackListener}侦听器(要么是因为PIN验证已成功,要么是不必要的)。模态对话框没有超时,因此集成者应考虑到侦听器可能无法立即被调用。在解析之前,PCON对话框将保持在前台。

抛出

如果调用者的应用清单中没有声明和签署所需的权限,则会出现NotAuthorizedError。

抛出

NotInternetConnectedError

注意

这种方法是等效的,这意味着在PCON已经处于该状态时尝试启用/禁用PIN不会导致要求PIN验证或发出状态更改事件。

参数

副作用 如果PCON的启用状态发生变化,则会发布一个URI为IPconStateChangeEventPayload::PCON_ON_STATE_CHANGE_TOPIC的事件。

前提条件

调用者需要权限com.amazon.kepler.parental_controls.write-pref-enablement

前提条件

设备必须连接互联网,或者必须缓存先前成功完成PIN验证时所用的PIN。如果没有互联网连接,则无法完成首次设置。


setContentRestrictionLevel()

setContentRestrictionLevel(contentRestrictionLevelName): Promise<void>

设置用户设备本地内容限制首选项。请参阅IParentalControlsPreferenceReader.getContentRestrictionLevel

参数

contentRestrictionLevelName

string

返回值

Promise<void>

前提条件

调用者需要权限com.amazon.kepler.parental_controls.write-pref-contentrestriction


setPinProtectAppLaunchPreference()

setPinProtectAppLaunchPreference(enable): Promise<void>

设置用户设备的本地首选项,即应用的启动是否应受PIN保护。

参数

enable

boolean

返回值

Promise<void>

前提条件

调用者需要权限com.amazon.kepler.parental_controls.write-pref-pinprotect-applaunch


setPinProtectProfileSwitchPreference()

setPinProtectProfileSwitchPreference(enable): Promise<void>

设置用户设备的本地首选项,即切换到成人个人资料是否应受PIN保护。

参数

enable

boolean

返回值

Promise<void>

前提条件

调用者需要权限com.amazon.kepler.parental_controls.write-pref-pinprotect-profileswitch


setPinProtectPurchasePreference()

setPinProtectPurchasePreference(enable): Promise<void>

设置用户设备的本地首选项,即在该设备上进行购买是否应受PIN保护。

参数

enable

boolean

返回值

Promise<void>

前提条件

调用者需要权限com.amazon.kepler.parental_controls.write-pref-pinprotect-purchase


Last updated: 2025年9月30日