# How can I restart device?

**URL:** <https://discuss.appium.io/t/how-can-i-restart-device/13712>\
**Category:** Support\
**Created:** [December 11, 2016, 4:06pm UTC](https://discuss.appium.io/t/how-can-i-restart-device/13712 "2016-12-11T16:06:07Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![selenUser](https://discuss.appium.io/user_avatar/discuss.appium.io/selenuser/32/6449_2.png) [@selenUser](https://discuss.appium.io/u/selenUser)\
**Post date:** [December 11, 2016, 4:06pm UTC](https://discuss.appium.io/t/how-can-i-restart-device/13712/1 "2016-12-11T16:06:07Z")

</div>

I set AppiumDriverLocalService + AndroidDriver,.  
My test should check my app after device reboot, but here my issue, I loose connection to device !  
there is a way to restart device without close appium + android drivers ?

Thanks for help

---

<div class="post-metadata">

**Author:** ![SatyaPrakashSolanki](https://discuss.appium.io/letter_avatar_proxy/v4/letter/s/e9a140/32.png) [@SatyaPrakashSolanki](https://discuss.appium.io/u/SatyaPrakashSolanki)\
**Post date:** [December 12, 2016, 7:17am UTC](https://discuss.appium.io/t/how-can-i-restart-device/13712/2 "2016-12-12T07:17:09Z")

</div>

@selenUser  
Try “adb reboot” command in your test case using java code with java.lang.Runtime class.

---

<div class="post-metadata">

**Author:** ![selenUser](https://discuss.appium.io/user_avatar/discuss.appium.io/selenuser/32/6449_2.png) [@selenUser](https://discuss.appium.io/u/selenUser)\
**Post date:** [December 12, 2016, 7:37am UTC](https://discuss.appium.io/t/how-can-i-restart-device/13712/3 "2016-12-12T07:37:18Z")

</div>

I tried but driver loosing connection of device

---

<div class="post-metadata">

**Author:** ![Cauthon](https://discuss.appium.io/user_avatar/discuss.appium.io/cauthon/32/2646_2.png) [@Cauthon](https://discuss.appium.io/u/Cauthon)\
**Post date:** [December 12, 2016, 8:04pm UTC](https://discuss.appium.io/t/how-can-i-restart-device/13712/4 "2016-12-12T20:04:33Z")

</div>

I’m not sure there is a way to reboot a device without losing the connection. By design, wouldn’t the device shut down all existing connections when it reboots?

The only thing I can think of right now is to write some custom code to poll for the device using adb and re-instantiate the driver once adb reports the device is available.

Good luck.

---

<div class="post-metadata">

**Author:** ![Nikhet\_raikar](https://discuss.appium.io/user_avatar/discuss.appium.io/nikhet_raikar/32/14380_2.png) [@Nikhet\_raikar](https://discuss.appium.io/u/Nikhet_raikar)\
**Post date:** [February 17, 2026, 3:50pm UTC](https://discuss.appium.io/t/how-can-i-restart-device/13712/5 "2026-02-17T15:50:32Z")

</div>

When the device reboots, write a custom code which will create a new instance for driver, also make sure to restart the appium server.

---

<div class="post-metadata">

**Author:** ![Anish\_Mehta](https://discuss.appium.io/user_avatar/discuss.appium.io/anish_mehta/32/14501_2.png) [@Anish\_Mehta](https://discuss.appium.io/u/Anish_Mehta)\
**Post date:** [March 11, 2026, 9:05am UTC](https://discuss.appium.io/t/how-can-i-restart-device/13712/6 "2026-03-11T09:05:45Z")

</div>

@selenUser Here is the working sample code for rebooting the device and initializing it in the same script without failing. You can try this out.  
This is very good use case of telecommunication companies as their use case contains frequent rebooting of the device which leads to device disconnection. This sample script might help there.

> **[App\_automation\_Java/App\_automation\_vjava/src/test/java at...](https://github.com/mehtaanish01/App_automation_Java/tree/8fc8ec6dfba97cdba1cdc077b5861d47254f3ea5/App_automation_vjava/src/test/java)**
>
> Contribute to mehtaanish01/App\_automation\_Java development by creating an account on GitHub.
