Search code examples
windows-phone-8windows-phonebackground-agents

Is it possible to access Windows.Devices.Sensors API from a background agent?


There is a list of unsupported APIs for background agents, such as Microsoft.Devices.Sensors. The sensors are also accessible through the runtime API Windows.Devices.Sensors, which is not in the list of unsupported APIs. Can they be used from a background agent? Or are there any special limitations to the runtime APIs?


Solution

  • Although the MSDN documentation doesn't specifically mention runtime instantiation (or dynamic loading) of unsupported API, they are not allowed.

    If restricted API usage is not detected at compile time by Visual Studio, it will be detected when your app is submitted to the store as this post from the Marker Metro blog notes...

    "when under certification static analysis will be understaken to resolve this issue whether or not these calls are made at runtime"