1

I'm attempting to run a timed Background Task in a Windows Universal app. In the Background Task, I'd like get some details about the user's phone, including remaining battery charge percent. It appears that the only way to access Battery info is through the Windows.Phone namespace, which is unavailable to a Windows Runtime component.

So far, I've tried some unconventional things, including adding a public static object property to the Background Task class, which I'd set to a reference to the Battery, and then retrieve information from via Reflection. This fails, because the reference is invariably null at runtime.

Is there any way to get battery information in a Background Task in a Universal Windows App?

1

1 Answer 1

1

Windows Phone 8.1 supports this via the Battery class, but there is no equivalent for Windows 8.1.

Looking forwards, Windows 10 provides a newer Battery class that works across all devices.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.