Android :: Scheduling Restart Of Crashed Service - But No Call To OnStart
Mar 7, 2010In the 1.6 API, is there a way to ensure that the onStart() method of a Service is called after the service is killed due to memory pressure?
View 4 RepliesIn the 1.6 API, is there a way to ensure that the onStart() method of a Service is called after the service is killed due to memory pressure?
View 4 RepliesIn the 1.6 API, is there a way to ensure that the onStart() method of a Service is called after the service is killed due to memory pressure? From the logs, it seems that the "process" that the service belongs to is restarted, but the service itself is not. I have placed a Log.d() call in the onStart() method, and this is not reached.
View 1 Replies View RelatedI have noticed that if my background service crashes the system will automatically restart the service after 5 seconds. This is great, but I have noticed that only the onCreate method gets called and not the onStart method. Does this mean the service is properly restarted or do I need to do something special in the onCreate method to make sure it is? I did have my initialisation logic in the onCreate method and my starting service logic in the onStart method but it looks like it will all have to be in the onCreate method.
View 2 Replies View RelatedMy activity bind a service. I want to call the service's function in activity's onStart/onCreate function, but it doesn't work. The service started sunless but the connection is null. When I just call the service's function in other function (onClick for example),
View 4 Replies View RelatedI have an application and I would like to be able to restart it on the event of an error or a crash/app shutdown. I am familiar with how to register BroadcastReceivers, use alarms, etc.
Is there any signal I could intercept that the app sends out when it shuts down? Or that the OS sends out when any app shuts down?
I have a service that needs to hold a persistent TCP connection, think IM. I'm reluctant to use setForeground() - the service being down temporarily isn't that big a deal, and I am assume I can trust that I'll be run again once memory is available, correct? The problem here is this. The service was started via startService() before being killed. However, when it is restarted, only onCreate() is executed. This makes it hard to continue, because starting work onCreate() means I can't even bind to the service (to say query it's status) without it doing so. Is this a bug or per design? What is the status of the service after it is being restarted? Is it consider "started" by the system, i.e. waiting for a call to stopService()?
View 2 Replies View RelatedI updated my app to use the "new" startForeground() method of Service. Now beta testers are complaining about the foreground app going slow. Is that a coincidence or does startForeground() mess with the thread's prio or does anything else but what is written below? Just as an additional information the background activity does some syncing, reports the progress to the notification using remote views and as it is not latency dependent I use (and did that before already) this: Process.setThreadPriority(Process.THREAD_PRIORITY_LOWEST);
Should I use another Priority? And if it makes any difference, how does that play with Android 1.5 devices?
We have a Service that continuously collects sensor data on the phone. This service should run "forever", e.g. as long as the user wants, and not be killed by the system. For clarification, this service is not intended for an app to be released in the market to the general public, it is written for a scientific study. So the people running the app are fully aware that their battery will sucked empty faster than usual, this is no problem. Anyways, my problem is that the service gets killed after a while of running. Sometimes after an hour, sometimes only after like 7 oder 10 hours. The Log-Entries when the service gets killed look like this. It just says "no longer want", sometimes without even calling onDestroy(), as far as I can tell.
07-20 17:07:11.593 I/ActivityManager(85): No longer want my.project.datalogging (pid 23918): hidden #16
07-20 17:07:11.593 I/WindowManager(85): WIN DEATH: Window{44c61570 my.project.datalogging/my.project.datalogging.DataLoggingApp paused=false}
07-20 17:07:11.603 I/BackgroundService(23925): onDestroy()
Or later (after I manually restarted it):
07-20 19:00:49.677 I/ActivityManager(85): No longer want my.project.datalogging:BackgroundService (pid 24421): hidden #17
07-20 19:00:49.677 I/ActivityManager(85): No longer want my.project.datalogging (pid 24415): hidden #18
07-20 19:00:49.807 85 10707 I WindowManager: WIN DEATH: Window{44f1ea58 my.project.datalogging/my.project.datalogging.DataLoggingApp paused=false}
I often see other services being killed with "no longer want" and then immediately restarted with "Scheduling restart of crashed service". For example here with runkeeper:
07-20 17:30:45.503 I/ActivityManager(85): No longer want com.fitnesskeeper.runkeeper (pid 24090): hidden #16
07-20 17:30:45.603 W/ActivityManager(85): Scheduling restart of crashed service com.fitnesskeeper.runkeeper/.services.RunKeeperService in 5000ms
07-20 17:33:52.989 I/ActivityManager(85): Start proc com.fitnesskeeper.runkeeper for service com.fitnesskeeper.runkeeper/.services.RunKeeperService: pid=24292 uid=10099 gids={3003, 1015}
The logs show no record of low memory. Testing is done on (several) Nexus One with 2.2 (Froyo FRF91). Is there any way I can achieve this behaviour with my app? Automatic restarting after being killed? Or this this something totally different that just looks similar in logcat?
Is there a way to prevent your service from restarting if it crashed?
View 7 Replies View RelatedAfter I either receive a phone call or make one, (and other undocumented interruptions) my application gets a NullPointerException when resuming my activity. Can any explain to me where it is and/or how to fix it?now, pls help me to fix this problem, how do i handle phone call or SMS received or such kind of interruptions?
View 2 Replies View Relatedscoured "call volume" threads and not sure if this is experienced by anyone else. Intermittently when I answer a call I can barely hear the other person. Call volume is at the highest setting. I try making it lower then higher and nothing changes. If I end the call and call the same person back I will get normal call volume behavior. This happens every 5-10 phone calls.
sound like an issue with the hardware?
1.) Model Number ? Droid
2.) Firmware Version ? 2.0.1
3.) Baseband Version ? C_01.3E.01P
4.) Kernel Version ? 2.6.29-omap1-g0dd7e0b android-build@apa26 #511
5.) Build Number ? ESD56
How do I restart my service automatically when my service gets killed or crashes, until and unless I myself de register the service.
View 2 Replies View RelatedSome Android application restarts automatically when i kill process manually. How this can be possible?
Is there anyone who know how to do like this on Android platform?
Is there any way not to force to restart the service once the service crash and is killed?
View 11 Replies View RelatedI have a Service and a PreferenceActivity that allows the user to edit some preferences. I would like to restart the Service once the user is done with the PreferenceActivity.
I understand that I can register onChange listeners for individual preference changes, but I do not want to restart the Service as each preference changes. I would like to do this when the user is done editing all the preferences. Short of having a "Apply Now" button in the PreferenceActivity, I do not see a straightforward way of doing this.
Due to overwhelming user complaints I have decided try allowing users of my Android application to move it to the SD card as per the official documentation. However, a core feature of my application requires a background service to be continuously running. When someone who has moved my app to their SD card mounts their SD card for whatever reason, my background service will be killed.
That's all okay by me, as long as I can restart the service at the first available opportunity. Unfortunately, despite the install-location guide claiming I can use the Broadcast Intent ACTION_EXTERNAL_APPLICATIONS_AVAILABLE to detect when the SD card is remounted locally, the documentation for that flag itself, this newsgroup discussion, and my own testing show that this broadcast is not delivered to the applications which become available. Only applications which have not been moved to the SD card get the Broadcast Intent. Is there any way to restart my background service without waiting for the user to open my app after the SD card is remounted?
I have a single Activity application, within it I have a service which creates an AlarmManager and sends a broadcast to a broadcast Receiver.If the activity which starts the services dies, (ie. divide by zero), the broadcast receiver stops the old service which created the AlarmManager.It works the first time. The second time, it does not.It seems like the AlarmManager is still active but the broadcast receiver is no longer receiving. It works great once!
View 2 Replies View RelatedAfter upgrading my application I would like the service to restart if it was running before. Is there any way to do this? I didn't see any Broadcast Intents that I could register for in the manifest.
View 1 Replies View RelatedI have an app widget that uses a Service to handle updates (as per the SDK sample). If a task killer kills the service, the widget obviously stops updating. Is there any way I can notify the widget that the service has been killed so it can attempt to restart it?
View 3 Replies View RelatedI'm developing a GPS tracking software on android. I need IPC to control the service from different activities. So I decide to develop a remote service with AIDL.This wasn't a big problem but now it's always running into the methods of the interface and not into those of my service class. Maybe someone could help me?If i now try to call a method from an activity for example start(trackId) nothing happens. The binding is OK. When debugging it always runs into the startTracking() in the generated ITrackingServiceRemote.java file and not into my TrackingService class. Where is the problem? I can't find anything wrong.
View 1 Replies View RelatedI am developing a ToDo reminder type of app for android. on creation of a new reminder an alarm and vibrator scheduler is created with a toast. This works on intents and broadcasts and is pretty straight forward stuff with putextras using the reminder id from the db. My problem is, if some one restart the phone, i guess all the scheduled alarm and vibrator tasks for the reminder will be killed. Once the phone restart again how to recreate the scheduler tasks.
View 2 Replies View Relatedi want to call a web service call, for that i used ksoap(j2me).when i do a service call i am getting the following exception java.lang.NoClassDefFoundError: javax/microedition/io/Connector.
View 3 Replies View RelatedI hosted my service WCF (.net) using a windows service,i can access to the service from any browser but when i tried to call it from android it doesn't respond. it works fine before the hosting procedure (i used host client by default on Visual Studio).The url that i try to attempt is from android emulator, and installed my webservice in the same local machine(endpoints address http://localhost.).
View 7 Replies View RelatedI have noticed that when aps restart my phone, it takes about 15 to 20 seconds to restart When i Power down, it takes MINUTES!Does anyone know of simple restart app I could use to avoid this? If not, anyone know someone who could make one?
View 3 Replies View RelatedI'm trying to start a floating activity from onStart to retrieve some info from the user right when the initial activity begins.
I have the following:
CODE:............
And callProfileDialog() is just:
CODE:..........
ProfileDialog.class returns a String from an input box. If the result returned is RESULT_CANCELED then I restart the activity.
The problem I'm having is that when the program starts, the screen is just black. If I hit the Back button a RESULT_CANCELED is returned then the initial activity shows as well as the floating activity (since it recalled itself when it got a RESULT_CANCELED). Why can't I get the activities show by calling ProfileDialog.class from onStart()? I got the same result when I called it at the end of onCreate() which is way I switch over to use onStart().
I have also tried the following:
CODE:.........
But this doesn't work either. It all works fine once I hit the back button but without doing that, it's all black.
In the Android Application Fundamentals it says that after the call to the onStart()-method of the activity lifecycle either the callback method Resume() or onStop() is called. In case of an "normal" Start of an activity the system calls onCreate(), onStart(), onResume().But does somebody know an example where onStart() - onStop() are executed one after another?
View 2 Replies View RelatedMy blackberry allowed me to program when my phone would shut off in the evening and turn on in the morning. Is there anything similar?
My wife has a habit of forgetting to lower the volume on her phone at night so we hear her reminders and such all night long (or at least until I get up and silence her phone)
I want to display a ListView with checkboxes, and I want some of the checkboxes pre-selected. The ListView has setAdapter called during onCreate, and the list information appears when the screen is drawn. However, when I attempt to set certain list items as checked, my ListView reports getChildCount() = 0.
My SharedPreferences contains a list of sounds that have been previously selected, as a comma delimited string of list indices. Because the list appears to have no children in onStart, my attempts to set items as checked fails.
On the good side, once the list is rendered, I can select entries and hit Back, and my selection is stored to SharedPreferences correctly.
How can I load my previous selection into the list? Should I be using something else here?
In the spirit of open source. here's my code:
CODE:.................................
I got my hands on Android which is really fun. But at some point I don't seem to understand the concept. I've got a Main class which reads like this:
CODE:....
In the onCreate(...) I set the layout to setContentView(R.layout.main); and add an OnTouchEvent Listener to the sole View in main.xml: myView.setOnTouchListener(new OnTouchListener() {@Override public boolean onTouch(View v, MotionEvent event){...
As you can see I also implemented a SensorEventListener which is used if required. All works fine so far.
But my problem is this (at this point my misunderstanding kicks in): whenever I rotate the device the onCreate(), onStart() etc. methods are called, causing my app to act as if it just started. Furthermore, I feel unable to implement an onSizeChanged(int w, int h, int oldw, int oldh) { ... } Listener.
Can anyone please explain where my error in reasoning is? I am working on a tiny app which is more or less done, except for the just mentioned bug(s). Maybe I got it all wrong but it does what it is supposed to do (i.e. sending touch positions and accelerometer data over the network via UDP).
I'm trying to find the "correct" way to do the following:
I have an activity with a button that starts a repeating task in the background. That is, if the user goes away from my activity, I want my task to still be scheduled and executed every x minutes. I want a status TextView to be displayed on the activity, and if the task happens to start executing while my activity is showing, the TextView should be updated so the user can be aware of what's going on. So basically, is there a way to start a scheduled background repeating task and be notified when it is executed? From what I saw in the sample applications, I understand I'm supposed to use AlarmManager and a Service but I'm not sure about the notification part.