Amit,
- With an alarm, the phone is only guaranteed to be awake for the
duration of your receiver's onReceive callback. Anything past that, you
need a WakeLock.
- startForegroud has nothing to do with wake/sleep modes, it has to do
with how important your service is to the user (and hence, how Android
treats it).
- The screen light is different from the CPU being awake. If you don't
need the screen to light up, use a PARTIAL_WAKE_LOCK:
http://developer.android.com/reference/android/os/PowerManager.html
-- Kostya
11.02.2011 12:15, Amit пишет:
Thanks a lot for detailed answer!
When alarm manager deliver intent to my app, at this time, phone gets
wake up and i am thinking to make service call startforeground() and
start processing in another thread.
Will this behaviour causes phone light on?
I am just looking to do some background processing(some network I/O)
and only in some scenario i may post notification which user may
choose to see by clicking that notification.But it is not really
required to make phone light On.
-Amit
On Feb 7, 1:42 pm, Kostya Vasilyev<[email protected]> wrote:
07.02.2011 9:53, Amit пишет:
As Kostya wrote: I should be considering that service may be killed in
extreme condition if OS think.
And not only under extreme conditions. Recent versions of Android are
more proactive about removing unneeded background services, AFAIK that's
where you see "No longer want<service name>" in the log cat.
You can tell the framework that your service is doing something
important and should not be killed by calling startForeground (and
stopForeground when done). Those are Android 2.0 API methods.
This is exalained here:
http://android-developers.blogspot.com/2010/02/service-api-changes-st...
Another option is to make it so that your service can handle being
killed and resume what it was doing when restarted.
-- Kostya
--
Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com
--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en