Re: [android-developers] Re: Battery Log using service

2011-05-04 Thread Dianne Hackborn
Look at the stack crawl that is printed when the app is crashed and try to determine from that what went wrong. That is your first job, before asking for help here. On Wed, May 4, 2011 at 1:20 AM, Omkar omkar.ghai...@gmail.com wrote: I have pasted my code below.. I somehow dont get the Toast

[android-developers] Re: Battery Log using service

2011-05-04 Thread Omkar
I have done that while debugging.. But don't know what exactly to look for in this case.. Hence a clue or something would be helpful. Thats why I have pasted the code so a direct pinpointing at error can be done by someone more experienced than me. Thanks Omkar On May 4, 4:09 pm, Dianne Hackborn

[android-developers] Re: Battery Log using service

2011-05-04 Thread lbendlin
post the stack trace. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For

[android-developers] Re: Battery Log using service

2011-05-03 Thread Omkar
By registering the receiver in either app context / manifest file, would I be saved from not having constantly run my service in background ? Bcos I also know that charging / discharging thru usb / power supply would occur once a day or may once in 2 days and it doesn't make sense to keep a

Re: [android-developers] Re: Battery Log using service

2011-05-03 Thread Kostya Vasilyev
You cannot receive ACTION_BATTERY_CHARGED through a receiver declared in the manifest. Registering a receiver with the Application context doesn't help if the process gets killed. The battery action is a sticky broadcast, so you can get the most recent value by calling registerReceiver with

[android-developers] Re: Battery Log using service

2011-05-03 Thread Omkar
Ok, so if I let the intent Action_Power_Connected trigger my service by declaring this intent filter in the manifest and then let my service log the required data by creating a registerReceiver for the Action_Battery_Changed within the code, then I would be saved by not having the service

Re: [android-developers] Re: Battery Log using service

2011-05-03 Thread Dianne Hackborn
On Tue, May 3, 2011 at 8:39 AM, Omkar omkar.ghai...@gmail.com wrote: Ok, so if I let the intent Action_Power_Connected trigger my service by declaring this intent filter in the manifest and then let my service log the required data by creating a registerReceiver for the Action_Battery_Changed

[android-developers] Re: Battery Log using service

2011-05-03 Thread Kevin TeslaCoil Software
 The suggest to create an alarm to wake up every 5 minutes is a good one.  That will actually be more robust than having a service always running. Would it be possible to expand on this at all? My (perhaps incorrect) method of testing behavior with a service that is always running is by killing

[android-developers] Re: Battery Log using service

2011-05-03 Thread Igor Prilepov
These are two opposite cases: 1. Your service is crashed (or killed) and Android tries to restart it after a certain timeout 2. On some conditions Android may decide to kill your service. Since the purpose of this action is to free some system resources it won't be restarted after a timeout.

Re: [android-developers] Re: Battery Log using service

2011-05-03 Thread Dianne Hackborn
It actually will be restarted after a timeout, even if it was killed to reclaim memory. (Actually the activity manager has no way to know why the service's process disappeared.) However if it is killed again soon after restarting, the system will quickly increase the time it waits until it tries

[android-developers] Re: Battery Log using service

2011-05-03 Thread Omkar
I have pasted my code below.. I somehow dont get the Toast at all even when the app is triggered on usb cable plugin to the device. It starts off but force closes.. Pls suggest whats wrong here. I have a intent filter under receiver for Action_Power_Connected and disconnected under the manifest

[android-developers] Re: Battery Log using service

2011-05-02 Thread lbendlin
Do you really need to know battery level with a once per second accuracy? Don't you think once every five minutes is enough? Think about using an Alarm manager rather than a service. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post

[android-developers] Re: Battery Log using service

2011-05-02 Thread srihari babu
register this receiver with application context. That would solve ur problem. second possible solution is that register receiver in manifest file. Regards, Srihari.R On May 2, 1:06 pm, Omkar omkar.ghai...@gmail.com wrote: Hi,     I have created a activity to show battery information when