reboot

Restart android device programmatically

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-26 20:06:21
问题 In my android application, I want to restart my android device on button click. But its not working. I have done this so far. ImageButton restartmob = (ImageButton) this.findViewById(R.id.restartmob); restartmob.setOnClickListener(new ImageButton.OnClickListener() { @Override public void onClick(View v) { Process proc = null; try { //proc = Runtime.getRuntime().exec(new String[] { "su", "-c", "reboot" }); proc = Runtime.getRuntime().exec(new String[]{"/system/bin/su","-c","reboot now"}); proc

How can I get the Windows last reboot reason

自古美人都是妖i 提交于 2019-11-26 19:10:59
问题 I'd like to know what is the Windows API function (if any exists) that provides information about the last Windows reboot source. There are three main possible causes: The computer crashed on a blue screen A user or a program shutdown/restarted the computer A power lost The more details I can get the better. However, I need to know at least which reason it is from the main ones. I need to support Windows Vista and Windows 7. Answer: It seems that there is no direct API to get that information

Android AlarmManager after reboot

允我心安 提交于 2019-11-26 18:37:49
I have a set of alarms that I need to keep after reboot. I've tried using on an boot receiver but they won't start again. I'm not sure if I understand the boot receiver and how to then restart all the alarms. I already have one receiver for my notifications, but don't know whether I can use the same receiver or if I need a new one? Could anyone point me to any good tutorials or help me out? Cheers Code : DatabaseHandler db = new DatabaseHandler(this); List<UAlarm> alarms = db.getAllAlarms(); AlarmManager am = (AlarmManager) getSystemService(Context.ALARM_SERVICE); for (UAlarm ua : alarms) {

iphone reboot programmatically

折月煮酒 提交于 2019-11-26 16:36:31
I have code system("reboot") The reboot command works in the terminal, but even if I run the app as root, the operation is still denied. Has anyone found any way that works, or can explain a bit about SBSetting's reboot, which makes me curious? I figured out a way to do it, although it's a bit convoluted. The problem is that even if you setup your app to run as root , when you make system() calls, you're apparently still limited to user mobile privileges. Since mobile cannot call reboot (successfully), this doesn't work. The way I got around this problem is to take advantage of a new feature

Android BroadcastReceiver, auto run service after reboot of device

送分小仙女□ 提交于 2019-11-26 16:04:11
Hello i am writing an application, which is when the phone reboot, the service will auto start instead of click on the application. Here is my code for BootCompleteReceiver.java package com.example.newbootservice; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; public class BootCompleteReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Intent service = new Intent(context, MsgPushService.class); context.startService(service); } } MsgPushService.java package com.example.newbootservice;

Start AlarmManager if device is rebooted

心不动则不痛 提交于 2019-11-26 15:59:42
问题 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?

Windows Installer-Avoid FileinUse dialog box when Installing a package

空扰寡人 提交于 2019-11-26 15:33:06
When ever there is an update patch of files that have to be replaced with the existing files and if one of the files is being used by any of the processes, then a file in use dialog box pops-up.I wanna avoid that dialog box and get that file queued up for installation so that it can be installed at the time of system reboot. I have read that the queuing the files for update at the time of reboot is the inbuilt functionality of windows installer. Can someone suggest me the way to remove that FileInUse Dialog box. I tried setting up the "MsiRMFilesInUse" property to "0" but it didn't work.

Runtime.exec() : Reboot in Android?

最后都变了- 提交于 2019-11-26 08:14:53
问题 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

iphone reboot programmatically

邮差的信 提交于 2019-11-26 04:50:41
问题 I have code system(\"reboot\") The reboot command works in the terminal, but even if I run the app as root, the operation is still denied. Has anyone found any way that works, or can explain a bit about SBSetting\'s reboot, which makes me curious? 回答1: I figured out a way to do it, although it's a bit convoluted. The problem is that even if you setup your app to run as root , when you make system() calls, you're apparently still limited to user mobile privileges. Since mobile cannot call

Android BroadcastReceiver, auto run service after reboot of device

喜你入骨 提交于 2019-11-26 04:41:44
问题 Hello i am writing an application, which is when the phone reboot, the service will auto start instead of click on the application. Here is my code for BootCompleteReceiver.java package com.example.newbootservice; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; public class BootCompleteReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Intent service = new Intent(context,