android-developers
[Arriba] [Todas las Listas]

Re: [android-developers] Re: El Servicio que Es parado en pantalla fuera

To: android-developers@xxxxxxxxxxxxxxxx
Subject: Re: [android-developers] Re: El Servicio que Es parado en pantalla fuera.
From: lin qian <lqsohu2008@xxxxxxxxx>
Date: Thu, 1 Dec 2011 11:29:41 +0800
Delivery-date: Wed, 30 Nov 2011 22:30:06 -0500
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=x-beenthere:received-spf:mime-version:in-reply-to:references:date :message-id:subject:from:to:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-google-group-id:list-post:list-help:list-archive:sender :list-subscribe:list-unsubscribe:content-type; bh=+b7BIUijq2kp/lEnjihXZ1p7guIy4tfOCZl3wmM67L4=; b=0XQ+wwoEW1WdX3xB29GAsOtcXNsKrMLIbYCPlcTpMgZo0SFTXGdgo1CnMLr5TFIUdp ZqVIvOaWF2k90L6E+hMAVQ/ZD7Isr442rXjrgiPxgiP+RUs7T0UOwfeGWwQoX9cUuNhP JetLTVJXtKvCRszYsU+fe3we2jixufvPlXaMg=
Envelope-to: traductor@xxxxxxxxxxx
In-reply-to: <CAM8hUSudOM6B82c+84bhsRENC4D+gDkguRn4Tgq55tuUdeF4SQ@mail.gmail.com>
List-archive: <http://groups.google.com/group/android-developers?hl=en_US>
List-help: <http://groups.google.com/support/?hl=en_US>, <mailto:android-developers+help@googlegroups.com>
List-id: <android-developers.googlegroups.com>
List-post: <http://groups.google.com/group/android-developers/post?hl=en_US>, <mailto:android-developers@googlegroups.com>
List-subscribe: <http://groups.google.com/group/android-developers/subscribe?hl=en_US>, <mailto:android-developers+subscribe@googlegroups.com>
List-unsubscribe: <http://groups.google.com/group/android-developers/subscribe?hl=en_US>, <mailto:android-developers+unsubscribe@googlegroups.com>
Mailing-list: list android-developers@xxxxxxxxxxxxxxxx; contact android-developers+owners@xxxxxxxxxxxxxxxx
References: <CAFmnVbEakvWiVMSBO5ThMXXEXqVGY++1fQ3BKJpqQp1saVOQjg@mail.gmail.com> <c32f6514-f55f-4954-ad30-2c7d8a97cf62@j15g2000yqf.googlegroups.com> <CANfPmZhsx6RtKYVWJV_gkyPC6FgSEVv_9_bPqkg5SHwW7h+5Bw@mail.gmail.com> <CAFmnVbFLNtPdVeV6FaBY8QiuB57vizJ-vXVd+OASG7fRo6hx8Q@mail.gmail.com> <CALLdnhNzcx1_bN6rR=Dy4QO4LDu7HUa1w2+w8yeqztsiaqcAmQ@mail.gmail.com> <CAFmnVbGJ1W27sGuz37T16M1Ha9mELcEZyev1K3A63EOQrwO14w@mail.gmail.com> <CAM8hUSs1hz1NRnwvACZSwfqPgrrUJuDfreKei85vuTvL2Yh8Rg@mail.gmail.com> <CANfPmZjFTjpL5qmwwwN3zLrQk6cHzAG7LbPwjQYGCBFK-dn0Lw@mail.gmail.com> <CAFmnVbGiTMyOahfnk8wbcy_H18EMnA2=N3WPbSkV8soTKyyMuQ@mail.gmail.com> <CANfPmZiwGkYx7qCeMs25e6ou4k0qfgW_G+9qQNMG4Vz7_7sgxA@mail.gmail.com> <CAM8hUSudOM6B82c+84bhsRENC4D+gDkguRn4Tgq55tuUdeF4SQ@mail.gmail.com>
Reply-to: android-developers@xxxxxxxxxxxxxxxx
Sender: android-developers@xxxxxxxxxxxxxxxx
Según estos, pienso algunos casos  encuentras :
sensor abierto
1: y entonces pantalla fuera, el teléfono cerrará sensor. Si pantalla encima, el sensor será comido, puedes *log el sensor va en. No es afectar *logging resultado.
2: si no cerrar sensor, lo pienso tendría que ser utilizado *AlarmManager a *log
porque que puede despertar arriba de CPU cuándo *asleep estado.

En aquí quiero aclarar diferente sobre Hilo.Sueño y *AlarmManager
Cuándo creo un *app utilizando sueño de hilo para correr algo #cada 20*s, corrido que
*app y entonces pantalla dejada de en  el dispositivo no conecta cualquier *usb línea , aproximadamente
sobre 20*m, conecto el *usb y *logcat ,
encuentro el hilo todavía corrido, *cpu no dormir, es *amazing. Podría das
algunos comentarios sobre aquello ?



En *Thu, *Jul 21, 2011 en 3:25 AM, *Dianne *Hackborn <hackbod@xxxxxxxxxxx>escribió:

> El único dos tipo de *wakelocks es parcial y lleno.  Un lleno *wakelock
> mantendrá la pantalla de automáticamente apagando, y la pantalla que es
> encima sin duda significará los sensores están corriendo.  Una vez el usuario pulsa el
> botón de poder y gira la pantalla fuera, aun así, eres en ningún mejor un estatal
> que aguantando un parcial despertar cerradura.
>
>
> En *Wed, *Jul 20, 2011 en 11:40 AM, *Filip *Havlicek <havlicek.filip@xxxxxxxxx
> > escribió:
>
>> Si estás intentando desarrollar una aplicación de mercado, pienso hay no
>> *workaround. Si justo quieres experimento con el *accelerometer dato, puedes probar tipo diferente de *wakelock como Mark sugirió, algunos de ellos podrían
>> trabajar. O justo mantener el dispositivo despierto mientras tú  los experimentos (a pesar de que
>> podrías necesitar a *recharge el dispositivo #cada pocas horas). Podría ser
>> posible de hacer algo sobre él en el nivel de OS si arraigas vuestros dispositivos,
>> a pesar de que que necesitarían un poco más cavando.
>>
>> Consideraciones mejores,
>> *Filip *Havlicek
>>
>> 2011/7/20 Chris *Conry <cjconry@xxxxxxxxx>
>>
>>> *Thanks para las respuestas,
>>> las Marcas notan ahora, estoy utilizando el *myTouch 4*g y *LG aliado, tristemente ambos de ellos
>>> adivino apagar sus sensores. Su bueno de oír que el *Nexus y algunos
>>> 2.3 dispositivo lo mantiene encima y *hopefully otros fabricantes adoptan esto.
>>>
>>> Adivino *i'*m yendo para probar y encontrar un trabajo alrededor. Cualesquier sugerencias?
>>> *Thank te
>>>
>>> En *Wed, *Jul 20, 2011 en 12:42 PM, *Filip *Havlicek <
>>> havlicek.filip@xxxxxxxxx> escribió:
>>>
>>>> Parcial despertar trabajos de cerradura justo bien con *accelerometer sensor en *Nexus
>>>> Uno 2.2 (probado esto para encima que 6 meses como parte de mi búsqueda),
>>>> a pesar de que esto no podría ser el caso para combinación diferente de dispositivo y versión
>>>> de OS.
>>>>
>>>>
>>>> 2011/7/20 *Dianne *Hackborn <hackbod@xxxxxxxxxxx>
>>>>
>>>>> Previo a 2.3 los sensores fueron apagados cuándo la pantalla fue fuera para
>>>>> reducir uso de batería.  Esto fue cambiado en 2.3, aunque es posible
>>>>> de hecho estamos yendo para acabar arriba de lamentar que cambio. :*p
>>>>>
>>>>> También incluso tan de 2.3, no sería sorprendido si los conductores de algún dispositivo
>>>>> todavía están apagando el hardware de sensor como parte de su administración de poder
>>>>> cuándo la pantalla va fuera.
>>>>>
>>>>> En *Wed, *Jul 20, 2011 en 8:53 AM, Chris *Conry <cjconry@xxxxxxxxx>escribió:
>>>>>
>>>>>> Y vuestra suposición era completamente correcto. *Thank te. El problema todavía
>>>>>> está pasando, apenas pegué el botón de poder las parones de dato *logging.
>>>>>> Es allí algo más *im perdiendo sobre *wakelock?
>>>>>>
>>>>>>
>>>>>> En *Wed, *Jul 20, 2011 en 11:26 AM, Mark *Murphy <
>>>>>> mmurphy@xxxxxxxxxxxxxxx> escribió:
>>>>>>
>>>>>>> Uso *adb *logcat, *DDMS, o el *DDMS perspectiva en *Eclipse para examinar
>>>>>>> *LogCat y mirada en el *stack el rastro asociado con vuestro *runtime
>>>>>>> error.
>>>>>>> Mi suposición es que no aguantas el DESPERTAR_permiso de CERRADURA.
>>>>>>>
>>>>>>> En *Wed, *Jul 20, 2011 en 11:21 AM, Chris *Conry <cjconry@xxxxxxxxx>
>>>>>>> escribió:
>>>>>>> > *Thanks para las respuestas,
>>>>>>> > Mirando a él el parcial despertar la cerradura tendría que ser mi solución, pero
>>>>>>> él *isnt
>>>>>>> > implementando bien. Mantengo conseguir un *runtime error en adquirir(). Mi
>>>>>>> código
>>>>>>> > parece:
>>>>>>> >                 PM = (*PowerManager)
>>>>>>> *getSystemService(Contexto.SERVICIO_de PODER);
>>>>>>> > PM= de WL.*newWakeLock(*PowerManager.PARCIAL_DESPERTAR_CERRADURA, "*Wakelock");
>>>>>>> > WL.Adquiere();
>>>>>>> > puse esto en el *onStartCommand(), es que *incorrect? Sólo
>>>>>>> > tendría que adquirir el *wakelock cuándo la pantalla apaga?
>>>>>>> > *Thank te
>>>>>>> > En *Wed, *Jul 20, 2011 en 3:59 AM, *Filip *Havlicek <
>>>>>>> havlicek.filip@xxxxxxxxx>
>>>>>>> > escribió:
>>>>>>> >>
>>>>>>> >> Adquirir un parcial despertar cerradura, que tendría que ayudar.
>>>>>>> >>
>>>>>>> >> 2011/7/20 Jan *Nielsen <jkn@xxxxxxxxxxx>
>>>>>>> >>>
>>>>>>> >>> Las maneras comunes de dormir en *java, sólo cuenta *cpu tiempo en
>>>>>>> el *Android
>>>>>>> >>> plataforma.
>>>>>>> >>> Así que un Hilo.Sueño(60 * 1000); puede acontecer 5 o 10 minutos si el
>>>>>>> teléfono
>>>>>>> >>> es en *standby, desde él sólo cuenta cuándo el *cpu es despierto.
>>>>>>> >>>
>>>>>>> >>> *afaik Necesitas utilizar *AlarmManager para conseguir llamado cuándo el teléfono
>>>>>>> es en
>>>>>>> >>> *standby.
>>>>>>> >>> Incluso un *handler *postDelayed *wont trabajo, cuando que es también despertar tiempo.
>>>>>>> >>>
>>>>>>> >>> En 19 *Jul., 23:20, Chris *Conry <cjco...@xxxxxxxxx> escribió:
>>>>>>> >>> > estoy intentando construir un *app que *logs dato de sensor(utilizando un
>>>>>>> servicio), y lo
>>>>>>> >>> > almacena a un *SQLite *database. Mi problema es que para
>>>>>>> *logging
>>>>>>> >>> > cuándo
>>>>>>> >>> > la pantalla es fuera. Trabaja perfectamente bien cuándo la pantalla es
>>>>>>> encima, pero
>>>>>>> >>> > cuándo
>>>>>>> >>> > *i gira la pantalla del dato no empieza *logging hasta que giro
>>>>>>> >>> > la pantalla
>>>>>>> >>> > encima. El proceso no está siendo matado, porque trabaja cuándo
>>>>>>> la pantalla
>>>>>>> >>> > vuelve
>>>>>>> >>> > encima.
>>>>>>> >>> >
>>>>>>> >>> > He probado implementándolo como Hilo. Pienso que *wont trabajo
>>>>>>> porque
>>>>>>> >>> > necesita un contexto para el *database. Y leí que utilizando
>>>>>>> >>> > "*startForeground",
>>>>>>> >>> > pero no cambió.
>>>>>>> >>> >
>>>>>>> >>> > Cualesquier Sugerencias? Puede cualquiera ayuda?
>>>>>>> >>> >
>>>>>>> >>> > *Thank Tú
>>>>>>> >>>
>>>>>>> >>> --
>>>>>>> >>> recibiste este mensaje porque eres *subscribed al
>>>>>>> *Google
>>>>>>> >>> Grupos "*Android *Developers" grupo.
>>>>>>> >>> A correo a este grupo, envía *email a *android-developers@xxxxxxxxxxxxxxxx
>>>>>>> 
>>>>>>> >>> A *unsubscribe de este grupo, envía *email a *android-*developers+unsubscribe@xxxxxxxxxxxxxxxx
>>>>>>> >>> 
>>>>>>> >>> Puesto que más opciones, visita este grupo en
>>>>>>> >>> *http://grupos.*google.*com/Grupo/*android-*developers?*hl=*en
>>>>>>> >>
>>>>>>> >> --
>>>>>>> >> Recibiste este mensaje porque eres *subscribed al *Google
>>>>>>> >> Grupos "*Android *Developers" grupo.
>>>>>>> >> A correo a este grupo, envía *email a *android-developers@xxxxxxxxxxxxxxxx
>>>>>>> 
>>>>>>> >> A *unsubscribe de este grupo, envía *email a *android-*developers+unsubscribe@xxxxxxxxxxxxxxxx
>>>>>>> >> 
>>>>>>> >> Puesto que más opciones, visita este grupo en
>>>>>>> >> *http://grupos.*google.*com/Grupo/*android-*developers?*hl=*en
>>>>>>> >
>>>>>>> > --
>>>>>>> > Recibiste este mensaje porque eres *subscribed al *Google
>>>>>>> > Grupos "*Android *Developers" grupo.
>>>>>>> > A correo a este grupo, envía *email a *android-developers@xxxxxxxxxxxxxxxx
>>>>>>> 
>>>>>>> > A *unsubscribe de este grupo, envía *email a *android-*developers+unsubscribe@xxxxxxxxxxxxxxxx
>>>>>>> > 
>>>>>>> > Puesto que más opciones, visita este grupo en
>>>>>>> > *http://grupos.*google.*com/Grupo/*android-*developers?*hl=*en
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Mark *Murphy (un *Commons Guy)
>>>>>>> *http://*commonsware.*com | *http://*github.*com/*commonsguy
>>>>>>> *http://*commonsware.*com/*blog | *http://*twitter.*com/*commonsguy
>>>>>>>
>>>>>>> *Android Formación...En Vuestra Oficina: *http://*commonsware.*com/Formación
>>>>>>>
>>>>>>> --
>>>>>>> recibiste este mensaje porque eres *subscribed al *Google
>>>>>>> Grupos "*Android *Developers" grupo.
>>>>>>> A correo a este grupo, envía *email a *android-developers@xxxxxxxxxxxxxxxx
>>>>>>> 
>>>>>>> A *unsubscribe de este grupo, envía *email a *android-*developers+unsubscribe@xxxxxxxxxxxxxxxx
>>>>>>> 
>>>>>>> Puesto que más opciones, visita este grupo en
>>>>>>> *http://grupos.*google.*com/Grupo/*android-*developers?*hl=*en
>>>>>>>
>>>>>>
>>>>>>  --
>>>>>> Recibiste este mensaje porque eres *subscribed al *Google
>>>>>> Grupos "*Android *Developers" grupo.
>>>>>> A correo a este grupo, envía *email a *android-developers@xxxxxxxxxxxxxxxx
>>>>>> 
>>>>>> A *unsubscribe de este grupo, envía *email a *android-*developers+unsubscribe@xxxxxxxxxxxxxxxx
>>>>>> 
>>>>>> Puesto que más opciones, visita este grupo en
>>>>>> *http://grupos.*google.*com/Grupo/*android-*developers?*hl=*en
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> *Dianne *Hackborn
>>>>> *Android Ingeniero de marco
>>>>> hackbod@xxxxxxxxxxx
>>>>>
>>>>> Nota: complacer no envía cuestiones privadas a mí, cuando no tengo tiempo
>>>>> para proporcionar apoyo privado, y así que no responderá a tal *e-correos.  Todas tales
>>>>> cuestiones tendrían que ser *posted en foros públicos, donde yo y otros podemos ver y contestarles.
>>>>> 
>>>>>
>>>>>  --
>>>>> Recibiste este mensaje porque eres *subscribed al *Google
>>>>> Grupos "*Android *Developers" grupo.
>>>>> A correo a este grupo, envía *email a *android-developers@xxxxxxxxxxxxxxxx
>>>>> 
>>>>> A *unsubscribe de este grupo, envía *email a *android-*developers+unsubscribe@xxxxxxxxxxxxxxxx
>>>>> 
>>>>> Puesto que más opciones, visita este grupo en
>>>>> *http://grupos.*google.*com/Grupo/*android-*developers?*hl=*en
>>>>>
>>>>
>>>>  --
>>>> Recibiste este mensaje porque eres *subscribed al *Google
>>>> Grupos "*Android *Developers" grupo.
>>>> A correo a este grupo, envía *email a *android-developers@xxxxxxxxxxxxxxxx
>>>> 
>>>> A *unsubscribe de este grupo, envía *email a *android-*developers+unsubscribe@xxxxxxxxxxxxxxxx
>>>> 
>>>> Puesto que más opciones, visita este grupo en
>>>> *http://grupos.*google.*com/Grupo/*android-*developers?*hl=*en
>>>>
>>>
>>> --
>>> Recibiste este mensaje porque eres *subscribed al *Google
>>> Grupos "*Android *Developers" grupo.
>>> A correo a este grupo, envía *email a *android-developers@xxxxxxxxxxxxxxxx
>>> A *unsubscribe de este grupo, envía *email a *android-*developers+unsubscribe@xxxxxxxxxxxxxxxx
>>> 
>>> Puesto que más opciones, visita este grupo en
>>> *http://grupos.*google.*com/Grupo/*android-*developers?*hl=*en
>>>
>>
>>  --
>> Recibiste este mensaje porque eres *subscribed al *Google
>> Grupos "*Android *Developers" grupo.
>> A correo a este grupo, envía *email a *android-developers@xxxxxxxxxxxxxxxx
>> A *unsubscribe de este grupo, envía *email a *android-*developers+unsubscribe@xxxxxxxxxxxxxxxx
>> 
>> Puesto que más opciones, visita este grupo en
>> *http://grupos.*google.*com/Grupo/*android-*developers?*hl=*en
>>
>
>
>
> --
> *Dianne *Hackborn
> *Android Ingeniero de marco
> hackbod@xxxxxxxxxxx
>
> Nota: complacer no envía cuestiones privadas a mí, cuando no tengo tiempo para
> proporcionar apoyo privado, y así que no responderá a tal *e-correos.  Todas tales
> cuestiones tendrían que ser *posted en foros públicos, donde yo y otros podemos ver y contestarles.
> 
>
>  --
> Recibiste este mensaje porque eres *subscribed al *Google
> Grupos "*Android *Developers" grupo.
> A correo a este grupo, envía *email a *android-developers@xxxxxxxxxxxxxxxx
> A *unsubscribe de este grupo, envía *email a *android-*developers+unsubscribe@xxxxxxxxxxxxxxxx
> 
> Puesto que más opciones, visita este grupo en
> *http://grupos.*google.*com/Grupo/*android-*developers?*hl=*en
>

-- 
Recibiste este mensaje porque eres *subscribed al *Google
Grupos "*Android *Developers" grupo.
A correo a este grupo, envía *email a *android-developers@xxxxxxxxxxxxxxxx
A *unsubscribe de este grupo, envía *email a *android-*developers+unsubscribe@xxxxxxxxxxxxxxxx

Puesto que más opciones, visita este grupo en
*http://grupos.*google.*com/Grupo/*android-*developers?*hl=*en
According these, I think some cases will you come across :
open sensor
1: and then screen off, phone will close sensor. if screen on, sensor will
be lunched, you can log the sensor go on. It's not affect logging result.
2: if not close sensor, I think it should be used AlarmManager to log
because that it can wake up CPU when asleep status.

In here I want to clarify different about Thread.sleep and AlarmManager
When I create a app using thread sleep to run something every 20s, run that
app and then let screen off  in device not connect any usb line , about
over 20m, I connect the usb and logcat ,
I find the thread still run, cpu not sleep, it's amazing. Could you give
some comments about that ?



On Thu, Jul 21, 2011 at 3:25 AM, Dianne Hackborn <hackbod@xxxxxxxxxxx>wrote:

> The only two types of wakelocks are partial and full.  A full wakelock
> will keep the screen from automatically turning off, and the screen being
> on will definitely mean the sensors are running.  Once the user presses the
> power button and turns the screen off, though, you are in no better a state
> than holding a partial wake lock.
>
>
> On Wed, Jul 20, 2011 at 11:40 AM, Filip Havlicek <havlicek.filip@xxxxxxxxx
> > wrote:
>
>> If you are trying to develop a market application, I think there is no
>> workaround. If you just want to experiment with the accelerometer data, you
>> can try different types of wakelock as Mark suggested, some of them might
>> work. Or just keep the device awake while you do the experiments (although
>> you might need to recharge the device every few hours). It might be
>> possible to do something about it on the OS level if you root your devices,
>> although that would need a bit more digging.
>>
>> Best regards,
>> Filip Havlicek
>>
>> 2011/7/20 Chris Conry <cjconry@xxxxxxxxx>
>>
>>> Thanks for the answers,
>>> Makes sense now, I am using the myTouch 4g and LG ally, sadly both of
>>> them I guess turn off their sensors. Its good to hear that the Nexus and
>>> some 2.3 device keep it on and hopefully other manufacturers adopt this.
>>>
>>> I guess i'm going to try and find a work around. Any suggestions?
>>> Thank you
>>>
>>> On Wed, Jul 20, 2011 at 12:42 PM, Filip Havlicek <
>>> havlicek.filip@xxxxxxxxx> wrote:
>>>
>>>> Partial wake lock works just fine with accelerometer sensor on Nexus
>>>> One 2.2 (tested this for over than 6 months as a part of my research),
>>>> although this might not be the case for different combination of device and
>>>> OS version.
>>>>
>>>>
>>>> 2011/7/20 Dianne Hackborn <hackbod@xxxxxxxxxxx>
>>>>
>>>>> Prior to 2.3 the sensors were turned off when the screen went off in
>>>>> order to reduce battery use.  This was changed on 2.3, though it's possible
>>>>> we are actually going to end up regretting that change. :p
>>>>>
>>>>> Also even as of 2.3, I wouldn't be surprised if some device's drivers
>>>>> are still turning off the sensor hardware as part of their power management
>>>>> when the screen goes off.
>>>>>
>>>>> On Wed, Jul 20, 2011 at 8:53 AM, Chris Conry <cjconry@xxxxxxxxx>wrote:
>>>>>
>>>>>> And your guess was completely correct. Thank you. The problem is
>>>>>> still happening, as soon as I hit the power button the data stops logging.
>>>>>> Is there something else im missing about wakelock?
>>>>>>
>>>>>>
>>>>>> On Wed, Jul 20, 2011 at 11:26 AM, Mark Murphy <
>>>>>> mmurphy@xxxxxxxxxxxxxxx> wrote:
>>>>>>
>>>>>>> Use adb logcat, DDMS, or the DDMS perspective in Eclipse to examine
>>>>>>> LogCat and look at the stack trace associated with your runtime
>>>>>>> error.
>>>>>>> My guess is that you do not hold the WAKE_LOCK permission.
>>>>>>>
>>>>>>> On Wed, Jul 20, 2011 at 11:21 AM, Chris Conry <cjconry@xxxxxxxxx>
>>>>>>> wrote:
>>>>>>> > Thanks for the replys,
>>>>>>> > Looking into it the partial wake lock should be my solution, but
>>>>>>> it isnt
>>>>>>> > implementing well. I keep getting a runtime error on acquire(). my
>>>>>>> code
>>>>>>> > looks like:
>>>>>>> >                 PM = (PowerManager)
>>>>>>> getSystemService(Context.POWER_SERVICE);
>>>>>>> > WL= PM.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "Wakelock");
>>>>>>> > WL.acquire();
>>>>>>> > I put this in the onStartCommand(), is that incorrect? Should
>>>>>>> > only acquire the wakelock when the screen turns off?
>>>>>>> > Thank you
>>>>>>> > On Wed, Jul 20, 2011 at 3:59 AM, Filip Havlicek <
>>>>>>> havlicek.filip@xxxxxxxxx>
>>>>>>> > wrote:
>>>>>>> >>
>>>>>>> >> Acquire a partial wake lock, that should help.
>>>>>>> >>
>>>>>>> >> 2011/7/20 Jan Nielsen <jkn@xxxxxxxxxxx>
>>>>>>> >>>
>>>>>>> >>> The common ways to sleep in java, only counts cpu time on the
>>>>>>> Android
>>>>>>> >>> platform.
>>>>>>> >>> So a Thread.sleep(60 * 1000); may become 5 or 10 minutes if the
>>>>>>> phone
>>>>>>> >>> is in standby, since it only counts when the cpu is awake.
>>>>>>> >>>
>>>>>>> >>> afaik you need to use AlarmManager to get called when the phone
>>>>>>> is in
>>>>>>> >>> standby.
>>>>>>> >>> Even a handler postDelayed wont work, as that is also wake time.
>>>>>>> >>>
>>>>>>> >>> On 19 Jul., 23:20, Chris Conry <cjco...@xxxxxxxxx> wrote:
>>>>>>> >>> > I'm trying to build an app that logs sensor data(using a
>>>>>>> service), and
>>>>>>> >>> > stores it into an SQLite database. My problem is that it stops
>>>>>>> logging
>>>>>>> >>> > when
>>>>>>> >>> > the screen is off. It works perfectly fine when the screen is
>>>>>>> on, but
>>>>>>> >>> > when i
>>>>>>> >>> > turn the screen off the data doesn't start logging until I
>>>>>>> turn the
>>>>>>> >>> > screen
>>>>>>> >>> > on. The process isn't being killed, because it works when the
>>>>>>> screen
>>>>>>> >>> > comes
>>>>>>> >>> > back on.
>>>>>>> >>> >
>>>>>>> >>> > I've tried implementing it as a Thread. I think that wont work
>>>>>>> because
>>>>>>> >>> > it
>>>>>>> >>> > needs a context for the database. And I read that using
>>>>>>> >>> > "startForeground",
>>>>>>> >>> > but it didn't change.
>>>>>>> >>> >
>>>>>>> >>> > Any Suggestions? Can anyone help?
>>>>>>> >>> >
>>>>>>> >>> > Thank you
>>>>>>> >>>
>>>>>>> >>> --
>>>>>>> >>> 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@xxxxxxxxxxxxxxxx
>>>>>>> >>> To unsubscribe from this group, send email to
>>>>>>> >>> android-developers+unsubscribe@xxxxxxxxxxxxxxxx
>>>>>>> >>> For more options, visit this group at
>>>>>>> >>> http://groups.google.com/group/android-developers?hl=en
>>>>>>> >>
>>>>>>> >> --
>>>>>>> >> 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@xxxxxxxxxxxxxxxx
>>>>>>> >> To unsubscribe from this group, send email to
>>>>>>> >> android-developers+unsubscribe@xxxxxxxxxxxxxxxx
>>>>>>> >> For more options, visit this group at
>>>>>>> >> http://groups.google.com/group/android-developers?hl=en
>>>>>>> >
>>>>>>> > --
>>>>>>> > 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@xxxxxxxxxxxxxxxx
>>>>>>> > To unsubscribe from this group, send email to
>>>>>>> > android-developers+unsubscribe@xxxxxxxxxxxxxxxx
>>>>>>> > For more options, visit this group at
>>>>>>> > http://groups.google.com/group/android-developers?hl=en
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Mark Murphy (a Commons Guy)
>>>>>>> http://commonsware.com | http://github.com/commonsguy
>>>>>>> http://commonsware.com/blog | 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@xxxxxxxxxxxxxxxx
>>>>>>> To unsubscribe from this group, send email to
>>>>>>> android-developers+unsubscribe@xxxxxxxxxxxxxxxx
>>>>>>> For more options, visit this group at
>>>>>>> http://groups.google.com/group/android-developers?hl=en
>>>>>>>
>>>>>>
>>>>>>  --
>>>>>> 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@xxxxxxxxxxxxxxxx
>>>>>> To unsubscribe from this group, send email to
>>>>>> android-developers+unsubscribe@xxxxxxxxxxxxxxxx
>>>>>> For more options, visit this group at
>>>>>> http://groups.google.com/group/android-developers?hl=en
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Dianne Hackborn
>>>>> Android framework engineer
>>>>> hackbod@xxxxxxxxxxx
>>>>>
>>>>> Note: please don't send private questions to me, as I don't have time
>>>>> to provide private support, and so won't reply to such e-mails.  All such
>>>>> questions should be posted on public forums, where I and others can see and
>>>>> answer them.
>>>>>
>>>>>  --
>>>>> 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@xxxxxxxxxxxxxxxx
>>>>> To unsubscribe from this group, send email to
>>>>> android-developers+unsubscribe@xxxxxxxxxxxxxxxx
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/group/android-developers?hl=en
>>>>>
>>>>
>>>>  --
>>>> 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@xxxxxxxxxxxxxxxx
>>>> To unsubscribe from this group, send email to
>>>> android-developers+unsubscribe@xxxxxxxxxxxxxxxx
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/android-developers?hl=en
>>>>
>>>
>>> --
>>> 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@xxxxxxxxxxxxxxxx
>>> To unsubscribe from this group, send email to
>>> android-developers+unsubscribe@xxxxxxxxxxxxxxxx
>>> For more options, visit this group at
>>> http://groups.google.com/group/android-developers?hl=en
>>>
>>
>>  --
>> 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@xxxxxxxxxxxxxxxx
>> To unsubscribe from this group, send email to
>> android-developers+unsubscribe@xxxxxxxxxxxxxxxx
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>>
>
>
>
> --
> Dianne Hackborn
> Android framework engineer
> hackbod@xxxxxxxxxxx
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  All such
> questions should be posted on public forums, where I and others can see and
> answer them.
>
>  --
> 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@xxxxxxxxxxxxxxxx
> To unsubscribe from this group, send email to
> android-developers+unsubscribe@xxxxxxxxxxxxxxxx
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
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@xxxxxxxxxxxxxxxx
To unsubscribe from this group, send email to
android-developers+unsubscribe@xxxxxxxxxxxxxxxx
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
<Anterior por Tema] Tema Actual [Siguiente por Tema>
  • Re: [android-developers] Re: El Servicio que Es parado en pantalla fuera., lin qian <=