The.Blue.Shrimp
The.Blue.Shrimp

Reputation: 193

How can i turn off the android emulator by using code in eclipse?

Is it possible to turn off the android emulator by using code in eclipse? And if yes,how can i turn it on again. In all the answers i found on the internet,the emulator was turned off by the command line,but i need to control it from eclipse. Thanks in advance.

Upvotes: 1

Views: 240

Answers (1)

Paperwaste
Paperwaste

Reputation: 685

You can programmatically reboot an android device using the following

PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
pm.reboot("your reason")

This requires the REBOOT permission in the manifest.

Upvotes: 1

Related Questions