[android-developers] Re: What is the best way to schedule an event that will wake up the phone if it goes into sleep mode?

2010-03-04 Thread Chen Ganir
Mark,

I posted my question in android-platform but there is no reply there.
The second group you recommended (android-framework) does not exist.

Do you have any other recommendations i can follow?

Thanks,
Chen Ganir.

On Mar 2, 4:52 pm, Mark Murphy mmur...@commonsware.com wrote:
 Chen Ganir wrote:
  I'm looking at the BluetoothService. The BluetoothService implements a
  mechanism to disable the discoverable mode after 120 seconds (in
  function setScanMode). However, if the system goes to sleep before
  that, what happens to the discoverable mode?

 You assume they are not holding a WakeLock somewhere.

  Why did google implement this
  mechanism like this, and not with an alarmManager to prevent such a
  problem?

 Because the device needs to be on for Bluetooth discovery to work, most
 likely.

 However, all of this is a firmware question. Further discussion on that
 belongs either on [android-framework] (if you are looking to contribute
 changes) or on [android-platform] (if you are not). This list is
 primarily for SDK-level development.

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://twitter.com/commonsguy

 _The Busy Coder's Guide to *Advanced* Android Development_
 Version 1.3 Available!

-- 
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 more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: What is the best way to schedule an event that will wake up the phone if it goes into sleep mode?

2010-03-02 Thread Chen Ganir
Hey Mark.

thanks for the quick response. I see that the AlarmManager is part of
the app package. Is it possible to use it in a system service?

Thanks,
Chen Ganir.


On Mar 2, 3:34 pm, Mark Murphy mmur...@commonsware.com wrote:
 Chen Ganir wrote:
  I was investigating the issue of setting up a delayed activity/event,
  that will occur and trigger even if the phone is in sleep mode (wake
  up, do what you need to do, go back to sleep).

  I was thinking of the following methods:
  1. sendMessageDelayed
  2. Timer
  3. AlarmManager

  The basic requirement is to be able to set a triger in the future, and
  be sure that this trigger wakes up the system if it is sleeping,
  perform the task, and go back to sleep.A partial wakup is required (no
  screen flickering).

  Currently i'm using the sendMessageDelayed, and i keep a wake lock
  held for the timeout period (bad practice).

 *Please* use AlarmManager for this!

 Here is a sample project showing the use of AlarmManager and a
 WakefulIntentService (allows you to take as much time as you need to do
 your work and keeps the device awake just long enough to do that work):

 http://github.com/commonsguy/cw-advandroid/tree/master/SystemServices...

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://twitter.com/commonsguy

 Android Training...At Your Office:http://commonsware.com/training

-- 
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 more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: What is the best way to schedule an event that will wake up the phone if it goes into sleep mode?

2010-03-02 Thread Mark Murphy
Chen Ganir wrote:
 thanks for the quick response. I see that the AlarmManager is part of
 the app package. Is it possible to use it in a system service?

What do you consider a system service to be?

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

_Beginning Android_ from Apress Now Available!

-- 
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 more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: What is the best way to schedule an event that will wake up the phone if it goes into sleep mode?

2010-03-02 Thread Chen Ganir
Mark,

I'm looking at the BluetoothService. The BluetoothService implements a
mechanism to disable the discoverable mode after 120 seconds (in
function setScanMode). However, if the system goes to sleep before
that, what happens to the discoverable mode? It will stay on until the
system wakes up and the message is sent? Why did google implement this
mechanism like this, and not with an alarmManager to prevent such a
problem?

Thanks,
Chen Ganir.


On Mar 2, 4:10 pm, Mark Murphy mmur...@commonsware.com wrote:
 Chen Ganir wrote:
  thanks for the quick response. I see that the AlarmManager is part of
  the app package. Is it possible to use it in a system service?

 What do you consider a system service to be?

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://twitter.com/commonsguy

 _Beginning Android_ from Apress Now Available!

-- 
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 more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: What is the best way to schedule an event that will wake up the phone if it goes into sleep mode?

2010-03-02 Thread Mark Murphy
Chen Ganir wrote:
 I'm looking at the BluetoothService. The BluetoothService implements a
 mechanism to disable the discoverable mode after 120 seconds (in
 function setScanMode). However, if the system goes to sleep before
 that, what happens to the discoverable mode?

You assume they are not holding a WakeLock somewhere.

 Why did google implement this
 mechanism like this, and not with an alarmManager to prevent such a
 problem?

Because the device needs to be on for Bluetooth discovery to work, most
likely.

However, all of this is a firmware question. Further discussion on that
belongs either on [android-framework] (if you are looking to contribute
changes) or on [android-platform] (if you are not). This list is
primarily for SDK-level development.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_
Version 1.3 Available!

-- 
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 more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: What is the best way to schedule an event that will wake up the phone if it goes into sleep mode?

2010-03-02 Thread Chen Ganir
Thanks Mark, I'll move my question to one of those groups.

Chen Ganir.


On Mar 2, 4:52 pm, Mark Murphy mmur...@commonsware.com wrote:
 Chen Ganir wrote:
  I'm looking at the BluetoothService. The BluetoothService implements a
  mechanism to disable the discoverable mode after 120 seconds (in
  function setScanMode). However, if the system goes to sleep before
  that, what happens to the discoverable mode?

 You assume they are not holding a WakeLock somewhere.

  Why did google implement this
  mechanism like this, and not with an alarmManager to prevent such a
  problem?

 Because the device needs to be on for Bluetooth discovery to work, most
 likely.

 However, all of this is a firmware question. Further discussion on that
 belongs either on [android-framework] (if you are looking to contribute
 changes) or on [android-platform] (if you are not). This list is
 primarily for SDK-level development.

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://twitter.com/commonsguy

 _The Busy Coder's Guide to *Advanced* Android Development_
 Version 1.3 Available!

-- 
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 more options, visit this group at
http://groups.google.com/group/android-developers?hl=en