[android-developers] Re: Saving service killing without startForeground

2009-12-04 Thread Nick
Hi everyone, I know it has been stated again and again that we should not start a service and leave it running for ever. What I was trying to do was to start a service once my package was installed, accomplish a couple of items and then stop the service (till my activity is started by the user).

[android-developers] Re: Saving service killing without startForeground

2009-12-04 Thread Nick
Hi all, I had a similar issue. What I wanted to do was to run a short service on boot up and initialize a few items and then stop the service. I understand that its not a good idea to leave the service running for the entire life-cycle of the phone. I was able to achieve this by creating a

[android-developers] Re: Saving service killing without startForeground

2009-12-04 Thread Nick
Hi all, I had a similar issue. What I wanted to do was to run a short service on boot up and initialize a few items and then stop the service. I understand that its not a good idea to leave the service running for the entire life-cycle of the phone. I was able to achieve this by creating a

Re: [android-developers] Re: Saving service killing without startForeground

2009-12-04 Thread Mark Murphy
I had a similar issue. What I wanted to do was to run a short service on boot up and initialize a few items and then stop the service. I understand that its not a good idea to leave the service running for the entire life-cycle of the phone. I was able to achieve this by creating a broadcast

Re: [android-developers] Re: Saving service killing without startForeground

2009-12-04 Thread Nick Ladhani
Thanks Mark Ok so for the first issue (stopping service) I will try your suggestion. For second question, when my activity starts there is an involved process of initializing bunch of items which requires few seconds. Hence I wanted to initialize these via a service on BOOT_COMPLETE (working for

Re: [android-developers] Re: Saving service killing without startForeground

2009-12-04 Thread Mark Murphy
I will try your suggestion. For second question, when my activity starts there is an involved process of initializing bunch of items which requires few seconds. Hence I wanted to initialize these via a service on BOOT_COMPLETE (working for me already) or on the package installation (which I

Re: [android-developers] Re: Saving service killing without startForeground

2009-12-04 Thread Dianne Hackborn
On Fri, Dec 4, 2009 at 9:45 AM, Nick ladn...@gmail.com wrote: I also wanted to start the same service once the package was installed. I tried using the PACKAGE_ADDED, PACKAGE_CHANGED intents but I guess the newly installed package does not receive these intents. Can any one point to another

Re: [android-developers] Re: Saving service killing without startForeground

2009-12-04 Thread Nick Ladhani
Thanks Mark and Dianne for your inputs. I will keep that in mind. ~Nick On Fri, Dec 4, 2009 at 2:12 PM, Dianne Hackborn hack...@android.com wrote: On Fri, Dec 4, 2009 at 9:45 AM, Nick ladn...@gmail.com wrote: I also wanted to start the same service once the package was installed. I tried

[android-developers] Re: Saving service killing without startForeground

2009-11-23 Thread Ash
Hi!! First of all I am extremely sorry for not providing the logs. (Kindly the find the logs below) Let me provide some more information about the service. Initially my test environment was full build, when I could successfully test the functionality I switched to SDK. The same software without

[android-developers] Re: Saving service killing without startForeground

2009-11-23 Thread Ash
At last I could find and fix the problem. The problem was after installing my package through ADT plug-in from Eclipse, for testing BOOT_COMPLETED event I had to restart the emulator every time, and when I run it again from Eclipse, my package receives the BOOT_COMPLETED event and starts running,

[android-developers] Re: Saving service killing without startForeground

2009-11-21 Thread Ash
Thanks for responding!! Well!! I am working with emulator currently and the behaviour is same. I have confirmed from the logs that the service is not crashing. All I could observe from the logs that System is killing the service(and hence the process) as its not a system service. your service is

Re: [android-developers] Re: Saving service killing without startForeground

2009-11-21 Thread Mark Murphy
Ash wrote: your service is not using a background thread Well my service is a multi-threaded application but not sure what you mean here. Your service presumably implements some combination of onCreate(), onStart(), onBind(), and onDestroy(). It might also implement some other callbacks,

Re: [android-developers] Re: Saving service killing without startForeground

2009-11-21 Thread Dianne Hackborn
2009/11/20 Cédric Berger cedric.berge...@gmail.com But if your service process is killed due to low memory, won't the system try to restart it later ? (though of course if there are still too many services running there is still a problem) Yes if the service was started with startService(),

[android-developers] Re: Saving service killing without startForeground

2009-11-20 Thread dadical
If you're running on a G1, and have even low-mid memory reqs, you are pretty much SOL. Android will kill off processes to free resources for new foreground activities, and services, particularly those running in a background process, will get axed first. Watch logcat in verbose mode to validate

Re: [android-developers] Re: Saving service killing without startForeground

2009-11-20 Thread Cédric Berger
On Fri, Nov 20, 2009 at 14:53, dadical keyes...@gmail.com wrote: If you're running on a G1, and have even low-mid memory reqs, you are pretty much SOL.  Android will kill off processes to free resources for new foreground activities, and services, particularly those running in a background