reboot

Reboot machine from a C#/WPF app

旧巷老猫 提交于 2019-11-27 13:31:47
问题 I want to have a button in my WPF app that restarts the machine. This app is always running on Vista. The fact that a quick search hasn't turned anything up makes me think this might be harder than I wish it was... any ideas? Thanks! 回答1: Try this: System.Diagnostics.Process.Start("shutdown.exe", "-r -t 0"); This starts Windows' inbuilt shutdown tool, which can also shut down or logoff a remote or the local machine. Here is the list of full options from ss64.com: Syntax SHUTDOWN [logoff

Start AlarmManager if device is rebooted

我与影子孤独终老i 提交于 2019-11-27 12:24:28
In my app I want to run some code every day at a specific time using an AlarmManager . In the android documentation I found this: Registered alarms are retained while the device is asleep [...] but will be cleared if it is turned off and rebooted. And that is the problem. I want to run the code even if the user reboots the phone. If the user reboots the phone he currently has to relaunch my app to start alarms again. How can I prevent this? Is there a better mechanism I should use instead? Create Boot Receiver using following code : public class BootBroadcastReceiver extends BroadcastReceiver

How to find the IP address of an amazon EC2 instance on reboot

余生颓废 提交于 2019-11-27 09:15:50
问题 On reboot, the IP address of an amazon instance changes. How to find the new IP address using java API? 回答1: Assuming you don't want to assign an Elastic IP address (and there are reasons why this is not always a solution) then simply call DescribeInstances on the rebooted instance, which returns a bunch of information including Public IP Address. Here's the AWS EC2 Java API Documentation on the topic. 回答2: On reboot, the IP addresses of an EC2 instance do not change. They do generally change

Android 2.2: Reboot device programmatically

隐身守侯 提交于 2019-11-27 08:42:34
I would like to know if there is a way to reboot the device through code. Ive tried: Intent i = new Intent(Intent.ACTION_REBOOT); i.putExtra("nowait", 1); i.putExtra("interval", 1); i.putExtra("window", 0); sendBroadcast(i); And added permissions for REBOOT but it still doesnt work. Thanks This seemed to work for me: try { Process proc = Runtime.getRuntime().exec(new String[] { "su", "-c", "reboot" }); proc.waitFor(); } catch (Exception ex) { Log.i(TAG, "Could not reboot", ex); } Still for rooted devices, but in case you want safer (process.waitFor() is conditioned, in separate try-catch, we

Why does my app throw an `android.permission.REBOOT SecurityException`?

北城余情 提交于 2019-11-27 04:47:28
问题 I wrote an Android app that uses android.os.PowerManager.reboot() , and I added <uses-permission android:name="android.permission.REBOOT" /> in my AndroidManifest.xml . However, when I run the app, it always throws the following exception: java.lang.SecurityException: Neither user 10039 nor current process has android.permission.REBOOT. at android.os.Parcel.readException(Parcel.java:1247) at android.os.Parcel.readException(Parcel.java:1247) at android.os.Parcel.readException(Parcel.java:1235)

How can a required reboot be detected for Windows 7

徘徊边缘 提交于 2019-11-27 03:24:42
问题 I am working on a project where several software and drivers are installed on a windows 7 PC. This shall work without user inputs. Now there is the question: How can I determine in this program if a reboot is required to finish an installation (can be driver or software). We are working on Windows 7 embedded and there is no taskbar enabled or any tooltips or something like this visible. Software is installed in silent mode. 回答1: Use the following registry key: HKLM\System\CurrentControlSet

Can I get logcat logs after phone reboots?

烈酒焚心 提交于 2019-11-27 00:30:14
问题 I'm testing an android application with a long running service. I'm using Eclipse and have the usb cord hooked up with the phone sitting next to me. Since it's a long ongoing service, I do some other work while it runs and check the logcat logs every once in a while to make sure everything is going as expected. A few minutes ago I noticed the phone rebooting. I think it's done this before as it would explain some weird application behavior. I quickly switched over to Eclipse to see what

NSUserDefaults losing its keys & values when phone is rebooted but not unlocked

雨燕双飞 提交于 2019-11-26 22:30:46
问题 We are currently experiencing the following weird issue with our iPhone app. As the title says, NSUserDefaults is losing our custom keys and values when phone is rebooted but not unlocked, and this is happening on a very specific scenario. Context: We are using the NSUserDefaults in the app to store user data (e.g. username). Our app has Location enabled on Background Mode. We are experiencing this issue only when distributing over the air or by Testflight. If I drag and drop the .ipa (same

Runtime.exec() : Reboot in Android?

ⅰ亾dé卋堺 提交于 2019-11-26 22:16:57
I'm looking for a solution which can be used to reboot a rooted device. I jknow that rebooting a device is very poor design for the user, as stated here , and it's not really for an application. The main purpose is to reboot the phone during my tests (I work on a video chat application, and sometimes I need to reboot when everything goes south) I observed that rebooting a phone is far far quicker using reboot in a terminal ( adb shell or ConnectBot for instance) than going through the usual of rebooting with the ACTION_REBOOT , that I can't use anyway. For the moment, I'm able to get the

Android: make notification persist across phone reboot

妖精的绣舞 提交于 2019-11-26 21:57:10
问题 What's the best way to have a status bar notification persist when the phone is turned off and on again? The only solution I can think of is to create the notification in a Service which starts in response to the BOOT_COMPLETED_ACTION Intent. 回答1: The only solution I can think of is to create the notification in a Service which starts in response to the BOOT_COMPLETED_ACTION Intent. For raising a Notification , you can probably get by with just doing it in the BOOT_COMPLETED_ACTION