问题
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