Radio.RequestAccessAsync only return DeniedByUser

早过忘川 提交于 2021-01-28 12:32:51

问题


Got problems getting access to radio control. I followed the MSDN and also downloaded their example.

MSDN states that when executing Radio.RequestAccessAsync(); it should pop a dialog asking the user to allow or deny.

Debugged the sample radio app from Microsoft here and put a breakpoint at var accessLevel = await Radio.RequestAccessAsync();

Again no popup with the access question but this time it returned allowed...idk why.

Created a new UWP project and all I added was Radio.RequestAccessAsync(); and under Capabilities i ticked Internet(Client)

Debugged on my phone (Windows 10) and got denied without a choice.

Where's the difference to the Microsoft approach? What am I missing?


回答1:


Ok figured it out. It's a device capability that need to get set.

Somehow theres no window in the Visual Studio Designer for the Device Capability located in Package.appxmanifest with a listing of all and to choose stuff.

Had to do it manually then.

  <Capabilities>
    <Capability Name="internetClient" />
    <DeviceCapability Name="radios" />  <!--This line is important-->
  </Capabilities>

Here's a list with the diff device capabilities MSDN

I should also mention that your access to the capabilities is restricted depending on your Developer account. But this just matters when publishing your app in the store i guess...

Apps that apply the special-use capabilities require a company account to submit them to the Store. In contrast, restricted capabilities do not require a special company account for the Store, they are not available for developers to use. Restricted capabilities are available only to apps that are developed by Microsoft and its partners. For more information about company accounts, see Account types, locations, and fees.



来源:https://stackoverflow.com/questions/34602074/radio-requestaccessasync-only-return-deniedbyuser

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!