Nikolay
Nikolay

Reputation: 91

How To Reboot Window 10 Phone From Universal App?

Is there a way to reboot the phone using c# code from an Universal App? I could not find anything in the github UWP samples library.

Upvotes: 1

Views: 390

Answers (2)

II ARROWS
II ARROWS

Reputation: 518

Except that you cannot do it, you should not reboot the system from code. Even (most) OS procedures ask user permission, all you can do is prompting the user asking for a reboot.

Also, you shouldn't need a system reboot. At most, what you need is an app restart. I looked for an "APP restart" API but I couldn't find it, but what you can do is closing it.

You should tell the user that the app will close, and doing so after the user confirmed invoking CoreApplication.Exit();.

The user then can reopen it.

Upvotes: 0

Romasz
Romasz

Reputation: 29792

UWP apps/Windows Store apps have very limited access to system method/resources - by design due to security issues.

There is no way to reboot the phone with official API.

You can try to find some hacks to do it - I've seen once some methods (don't have links now) using Pinvoke in WP8.1 - but you cannot be sure if they will work and/or pass certification.

Upvotes: 2

Related Questions