restart

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?

How to detect whether Windows is shutting down or restarting

◇◆丶佛笑我妖孽 提交于 2019-11-26 14:16:15
问题 I know that when Windows is shutting down, it sends a WM_QUERYENDSESSION message to each application. This makes it easy to detect when Windows is shutting down. However, is it possible to know if the computer going to power-off or is it going to restart after Windows has shutdown. I am not particularly hopeful, considering the documentation at MSDN has this to say about WM_QUERYENDSESSION : "...it is not possible to determine which event is occurring," but the cumulative cleverness of

How to force a service restart?

a 夏天 提交于 2019-11-26 13:18:37
问题 I have a background service that sometimes gets killed by the OS when it is running low on memory. How to simulate this behaviour so I can debug it? The dev guide simply says "if your service is started, then you must design it to gracefully handle restarts by the system. If the system kills your service, it restarts it as soon as resources become available again". What's the sequence of calls from when it gets killed to when it finishes restarting? On a side (related) question, what happens

Android Service Stops When App Is Closed

十年热恋 提交于 2019-11-26 11:43:44
I am starting a service from my main Android activity as follows: final Context context = base.getApplicationContext(); final Intent intent = new Intent(context, MyService.class); startService(intent); When I close the activity page by swiping it out from the recent apps list, the service stops running and restarts after some time. I can't use persistent services with notifications because of my app requirements. How can I make the service NOT restart or shutdown and just keep on running on app exit? aljuaid86 I'm in the same situation, so far I learned when the app is closed the service get

How to restart app if it unexpectedly shutdown

冷暖自知 提交于 2019-11-26 10:36:16
问题 Skype update text contains next: App auto restarts if unexpectedly shut down How is possible to perform that via SDK? 回答1: As far as I know, some sort of apps can be run in background and can be restarted in specific case. This is from Apple docs https://developer.apple.com/library/ios/#documentation/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html#//apple_ref/doc/uid/TP40007125 If you start this service and your application is subsequently terminated,

How to recall or restart MathJax?

喜欢而已 提交于 2019-11-26 10:31:41
问题 I need MathJax to recheck again all my page. I mean when the page is created it does all great. But I need to call it after window.onload to reparse the page, as its contents have changed in the meantime. How would I do such a thing? 回答1: See http://docs.mathjax.org/en/latest/advanced/typeset.html: If you are writing a dynamic web page where content containing mathematics may appear after MathJax has already typeset the rest of the page, then you will need to tell MathJax to look for

How do I shutdown, restart, or log off Windows via a bat file?

别来无恙 提交于 2019-11-26 09:14:51
问题 I\'ve been using Remote Desktop Connection to get into a workstation. But in this environment, I cannot use the power options in Start Menu. I need an alternative way to shutdown or restart. How do I control my computer\'s power state through the command line? 回答1: The most common ways to use the shutdown command are: shutdown -s — Shuts down. shutdown -r — Restarts. shutdown -l — Logs off. shutdown -h — Hibernates. Note: There is a common pitfall wherein users think -h means "help" (which it

Android Service Stops When App Is Closed

南楼画角 提交于 2019-11-26 03:27:57
问题 I am starting a service from my main Android activity as follows: final Context context = base.getApplicationContext(); final Intent intent = new Intent(context, MyService.class); startService(intent); When I close the activity page by swiping it out from the recent apps list, the service stops running and restarts after some time. I can\'t use persistent services with notifications because of my app requirements. How can I make the service NOT restart or shutdown and just keep on running on

How can I restart a Java application?

≯℡__Kan透↙ 提交于 2019-11-26 00:36:21
问题 How can I restart a Java AWT application? I have a button to which I have attached an event handler. What code should I use to restart the application? I want to do the same thing that Application.Restart() do in a C# application. 回答1: Of course it is possible to restart a Java application. The following method shows a way to restart a Java application: public void restartApplication() { final String javaBin = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java";