[android-developers] Re: Accelerometer not working when screen turns off

2018-03-28 Thread sardar khan
How Google Fit app works when phone is locked and how he get sensor values. 
And Our apps don't get sensor values when phone is locked.

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/f1525ee1-0bd6-42b5-a432-916c770fd98b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] Re: Accelerometer OnSensorChanged() no longer occur in standby

2016-06-10 Thread Amir Farazmand
@ Dianne Hackborn, this is a big issue and I guess deserves more than your 
wishy-washy answer. Android/Java are not just programming languages but 
cultures that define the people who dont want sticking to control freaks 
such as Steve Jobs and Bill Gates. Many people like to have this feature so 
that they can use the mobile as a monitoring device for large projects. I 
am happy to sacrifice a phone' battery to do the job I need without 
publishing this on Google Play. Currently, I leave the screen on which is a 
lot worse than leaving just the accelerometer on. Seeing this topic in many 
places, I think Android team should allow people to do whatever they like 
with their phone.


On Saturday, August 29, 2009 at 1:04:11 AM UTC+10, polymorph wrote:
>
> Hi, 
> I have written an application (a service) that uses the accelerometer 
> to detect movement, and up until recently this has worked fine when 
> the device was in standby.   It has been regularly tested on HTC G1 
> and Magic and tested specifically to work under these conditions, but 
> it seems that a recent Firmware upgrade may have broken this (my Magic 
> stopped working in this scenario since the last firmware I think, a 
> few weeks ago).  I have recently acquired an HTC Hero and this also 
> fails to get the notifications. 
>
> What seems to occur now, is that the 
> SensorEventListener.OnSensorChanged() messages are not occuring at all 
> in standby, and they continue once the device is switched back on. 
>
> The application also checks for other changes such as GPS location 
> changes, and these continue to work in standby, so I would expect the 
> sensor messages to also continue to get through as they did 
> previously. 
>
> I have tried a wakelock, but only the full, screen-on wakelock allows 
> it to work, which is undesirable behaviour. 
>
> Can anyone help?  This has effectively broken my Android Market 
> application :( 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/ee782441-e67e-47d3-9cd8-9b96d770bae6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] Re: Accelerometer use (G's and frequency)

2012-10-17 Thread Christian Nikolaj Thomsen
1) and 2) are hardware dependent. If you need something with higher 
acceleration range than standard handsets, you'd probably have to have it 
built. Accelerometer - chips are made to many different specs, but 
generally, the higher sensitivity, the lower the range. Remember also that 
there can be both Acceleration and Gravity sensors on android devices, 
one measures zero acceleration when lying still, one measures 1G (~ 
+9.81m/s^2) when lying still. 
The update-speed is also determined by the specific device.
3) An accelerometer is probably not a good way to detect a golf-swing - 
at least not alone. Acc-sensors measure linear accelerations. If you 
combine it with a gyroscope-sensor you could test for a simultaneous 
rotation and high-G type of movement. Otherwise it would be difficult to 
determine if the user is merely shaking his phone...
Also be aware that even a just couple of G's are quite a bit! - Android 
devices are really meant to be weaponized - not yet at least...

Cheers Christian

On Monday, July 23, 2012 7:35:28 PM UTC+2, JAM wrote:

 Hello all.
  
 Hope someone can help.  
  
 1)  Is there a way to have a program read higher than 1-2gs?  I had a beta 
 version built and it doesn't seem to have the ability to read more than 1g 
 on some of the phones I've tested it on.
  
 2)  Is there a way to get the phone to receive more samples than the 
 20-40ms it seems to do when set to fastest?  I need a more accurate 
 profile of the accelerometer output than I'm getting.
  
 3)  If I gave someone a specific profile of something I'd like the 
 accelerometer to find (a spike that gets above 2g and stays there for a 
 duration of 5ms or longer -- like a golf swing), could it be programed to 
 see such an incident consistantly?
  
  


-- 
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: Accelerometer use (G's and frequency)

2012-10-16 Thread Chris Sarbora
I'm totally talking out of my butt (have not looked at the relevant code) 
but I'm guessing that questions 1 and 2 have more to do with 
driver/hardware limits than Android-imposed limits.

On Monday, October 15, 2012 6:55:47 PM UTC-7, Guillermo Polonsky wrote:

 Did you get a reply on any of these questions? I'm interested too.
 BTW, I don't think is would be probably to get more than 3Gs as for 
 example the accelerometer of the Samsung Galaxy S2 can detect a maximum of 
 19m/s^2 which is approx 3.3Gs
 Best Regards. Guillermo.

 El lunes, 23 de julio de 2012 14:35:28 UTC-3, JAM escribió:

 Hello all.
  
 Hope someone can help.  
  
 1)  Is there a way to have a program read higher than 1-2gs?  I had a 
 beta version built and it doesn't seem to have the ability to read more 
 than 1g on some of the phones I've tested it on.
  
 2)  Is there a way to get the phone to receive more samples than the 
 20-40ms it seems to do when set to fastest?  I need a more accurate 
 profile of the accelerometer output than I'm getting.
  
 3)  If I gave someone a specific profile of something I'd like the 
 accelerometer to find (a spike that gets above 2g and stays there for a 
 duration of 5ms or longer -- like a golf swing), could it be programed to 
 see such an incident consistantly?
  
  



-- 
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: Accelerometer use (G's and frequency)

2012-10-15 Thread Guillermo Polonsky
Did you get a reply on any of these questions? I'm interested too.
BTW, I don't think is would be probably to get more than 3Gs as for example 
the accelerometer of the Samsung Galaxy S2 can detect a maximum of 19m/s^2 
which is approx 3.3Gs
Best Regards. Guillermo.

El lunes, 23 de julio de 2012 14:35:28 UTC-3, JAM escribió:

 Hello all.
  
 Hope someone can help.  
  
 1)  Is there a way to have a program read higher than 1-2gs?  I had a beta 
 version built and it doesn't seem to have the ability to read more than 1g 
 on some of the phones I've tested it on.
  
 2)  Is there a way to get the phone to receive more samples than the 
 20-40ms it seems to do when set to fastest?  I need a more accurate 
 profile of the accelerometer output than I'm getting.
  
 3)  If I gave someone a specific profile of something I'd like the 
 accelerometer to find (a spike that gets above 2g and stays there for a 
 duration of 5ms or longer -- like a golf swing), could it be programed to 
 see such an incident consistantly?
  
  


-- 
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: Accelerometer range

2012-10-15 Thread Guillermo Polonsky
Hi, the link is broken, is it possible to share its content?
BTW, I own a Samsung Galaxy S2 and the highest G I can get is 3.3, is there 
any possibility to get higer Gs?
Thanks in advance. Guillermo.

El viernes, 10 de junio de 2011 16:33:24 UTC-3, Ted escribió:

 I am writing an app that uses accelerometer. After some testings I 
 noticed that the range of values that the app shows is -2g to 2g. 
 http://www.bosch-sensortec.com/content/ ... Rev1.3.pdf states that the 
 range can be switched. How do I switch it to 4g?

-- 
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: Accelerometer range

2012-09-18 Thread Dan Reznik
Ted I would love to switch the range on my galaxy s3 to +/- 4 or 8g. The 
chip used by the S3 appears to be the SMB380

Have you had any luck on this matter over the last year?

Dan

On Friday, June 10, 2011 4:33:24 PM UTC-3, Ted wrote:

 I am writing an app that uses accelerometer. After some testings I 
 noticed that the range of values that the app shows is -2g to 2g. 
 http://www.bosch-sensortec.com/content/ ... Rev1.3.pdf states that the 
 range can be switched. How do I switch it to 4g?

-- 
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: Accelerometer not working when screen turns off

2012-09-14 Thread Detroit Tea

Partial wake lock doesn't work for me either.  

SCREEN_DIM_WAKE_LOCK works. I'm using a Cliq XT running CM7.

On Wednesday, August 25, 2010 3:38:25 AM UTC-7, Furiaceca wrote:

 Hello, 
 I tried few days ago with my HTC Desire and the official Froyo 
 release ... but when the screen is off the sensor never provide any 
 data: I use Partial Wake lock but this doesn't work. 
 Have you success by using Partial Wake lock? Which smartphone are you 
 using? 

 Thanks a lot 
 Carlo 

 On 16 Lug, 17:06, Bret Foreman bret.fore...@gmail.com wrote: 
  My application will run extensively in partial wakelock mode and I'm 
  very curious to see what standby power consumption consequences that 
  has for various popular phones. Maybe we should start a thread just 
  for that purpose where people can post their observations of battery 
  life in this mode for various phones.

-- 
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: Accelerometer frequency

2012-08-07 Thread 신후철
hi i'm trying to logging  the data received with timestamps for magnetic 
field sensor, could you give me 
the java code that you used in this article?

2009년 2월 18일 수요일 오후 4시 8분 2초 UTC+9, gjs 님의 말:

 Hi, 

 Try logging the data received with timestamps ( in memory ) for 
 android.hardware.SensorListener.onSensorChanged(int sensor, float[] 
 values) and you'll soon work out the Frequency, I have found 
 accelerometer updates being received at approximately 30~40ms 
 intervals on a G1 eg: 

 1227266554492 2 [0] = 0.16344418 [1] = -9.629586 [2] = -1.3620348 [3] 
 = 0.16344418 [4] = -9.629586 [5] = -1.3620348 
 1227266554495 1 [0] = 7.3883734 [1] = -82.0 [2] = 1.0 [3] = 7.3883734 
 [4] = -82.0 [5] = 1.0 
 1227266554525 8 [0] = 8.3125 [1] = 12.875 [2] = -71.5625 [3] = 8.3125 
 [4] = 12.875 [5] = -71.5625 
 1227266554528 2 [0] = 0.05448139 [1] = -9.684067 [2] = -1.3075534 [3] 
 = 0.05448139 [4] = -9.684067 [5] = -1.3075534 
 1227266554531 1 [0] = 7.5050936 [1] = -82.0 [2] = 0.0 [3] = 7.5050936 
 [4] = -82.0 [5] = 0.0 
 1227266554564 8 [0] = 8.5625 [1] = 12.125 [2] = -71.5625 [3] = 8.5625 
 [4] = 12.125 [5] = -71.5625 
 1227266554566 2 [0] = 0.040861044 [1] = -9.670447 [2] = -1.3211738 [3] 
 = 0.040861044 [4] = -9.670447 [5] = -1.3211738 
 1227266554603 8 [0] = 8.0625 [1] = 12.375 [2] = -71.8125 [3] = 8.0625 
 [4] = 12.375 [5] = -71.8125 
 1227266554606 2 [0] = -0.013620348 [1] = -9.724928 [2] = -1.2666923 
 [3] = -0.013620348 [4] = -9.724928 [5] = -1.2666923 
 1227266554609 1 [0] = 7.5050936 [1] = -83.0 [2] = 0.0 [3] = 7.5050936 
 [4] = -83.0 [5] = 0.0 
 1227266554643 8 [0] = 8.3125 [1] = 12.375 [2] = -71.8125 [3] = 8.3125 
 [4] = 12.375 [5] = -71.8125 
 1227266554646 2 [0] = -0.013620348 [1] = -9.615966 [2] = -1.2666923 
 [3] = -0.013620348 [4] = -9.615966 [5] = -1.2666923 
 1227266554649 1 [0] = 7.5050936 [1] = -82.0 [2] = 0.0 [3] = 7.5050936 
 [4] = -82.0 [5] = 0.0 
 1227266554683 8 [0] = 7.8125 [1] = 11.625 [2] = -71.5625 [3] = 7.8125 
 [4] = 11.625 [5] = -71.5625 
 1227266554686 2 [0] = 0.040861044 [1] = -9.615966 [2] = -1.2666923 [3] 
 = 0.040861044 [4] = -9.615966 [5] = -1.2666923 

 (These examples were when using SENSOR_DELAY_GAME rate, you can 
 probably do better if you listen just for the accelerometer updates 
 and use a faster RATE) 

 You can also vary this Frequency (rate) with 
 android.hardware.SensorManager.registerListener(SensorListener 
 listener, int sensors, int rate) 

 intSENSOR_DELAY_FASTESTget sensor data as fast as possible 
 intSENSOR_DELAY_GAMErate suitable for games 
 intSENSOR_DELAY_NORMALrate (default) suitable for screen 
 orientation 
 changes 
 intSENSOR_DELAY_UIrate suitable for the user interface 

 I can't help you with the Precision, maybe have a look at 
 android.hardware.SensorListener.onAccuracyChanged (int sensor, int 
 accuracy). 

 Another idea is to find the specs for the sensor being used in the g1 
 or g2, but there is nothing like measuring it for yourself 

 Regards 

 On Feb 17, 8:39 pm, ashu montoo...@gmail.com wrote: 
  So my question still stands.  Frequency? Precision?  Thanks for the 
  attempt, Jubei. 
  
  On Feb 11, 6:14 am, Jubei nkatza...@gmail.com wrote: 
  
   Supposedly you pass a 3rd parameter to the sensormanager's 
   registerLister function but It doesnt seem to make any difference. 
  
   On Feb 11, 7:33 pm,ashumontoo...@gmail.com wrote: 
  
Hey, I wanted to get the frequency of accelerometer output.  How 
 many 
readings can I get per second?  And to what precision do I get? 
  Thanks- Hide quoted text - 
  
   - Show quoted text -

-- 
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: Accelerometer OnSensorChanged() no longer occur in standby

2012-08-06 Thread Pavel Brans
Hi all,
Three years pased. We faced the same problem. Sensors turn off after 
turning off the screen. Wake lock does not always help. Is this bug fixed? 
 In what version is it fixed (2х, 4x)?

---
Regards,
Pavel Konovalov

пятница, 28 августа 2009 г., 18:04:11 UTC+3 пользователь polymorph написал:

 Hi, 
 I have written an application (a service) that uses the accelerometer 
 to detect movement, and up until recently this has worked fine when 
 the device was in standby.   It has been regularly tested on HTC G1 
 and Magic and tested specifically to work under these conditions, but 
 it seems that a recent Firmware upgrade may have broken this (my Magic 
 stopped working in this scenario since the last firmware I think, a 
 few weeks ago).  I have recently acquired an HTC Hero and this also 
 fails to get the notifications. 

 What seems to occur now, is that the 
 SensorEventListener.OnSensorChanged() messages are not occuring at all 
 in standby, and they continue once the device is switched back on. 

 The application also checks for other changes such as GPS location 
 changes, and these continue to work in standby, so I would expect the 
 sensor messages to also continue to get through as they did 
 previously. 

 I have tried a wakelock, but only the full, screen-on wakelock allows 
 it to work, which is undesirable behaviour. 

 Can anyone help?  This has effectively broken my Android Market 
 application :( 


-- 
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: Accelerometer not working when screen turns off

2012-01-20 Thread crennie
I would prefer a way to do it that wouldn't drain the battery. 

-- 
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: Accelerometer not working when screen turns off

2012-01-20 Thread Mark Murphy
On Fri, Jan 20, 2012 at 10:52 AM, crennie cmren...@gmail.com wrote:
 I would prefer a way to do it that wouldn't drain the battery.

You act as though you have a choice. You do not.

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

Android 4.0 Programming Books: http://commonsware.com/books

-- 
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: Accelerometer not working when screen turns off

2012-01-19 Thread crennie
I found that if I'm connected with USB and watching Logcat my accelerometer 
sensor is still firing even when the screen is off. When I run the same 
program with out the USB connected the sensor stop a few seconds after the 
screen goes dark. I wonder if there is a work around here waiting to be 
found. Can you fool the phone into thinking it is connected to USB? 

-- 
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: Accelerometer not working when screen turns off

2012-01-19 Thread Kristopher Micinski
can this not be fixed using a partial wake lock?

kris

On Thu, Jan 19, 2012 at 11:23 AM, crennie cmren...@gmail.com wrote:
 I found that if I'm connected with USB and watching Logcat my accelerometer
 sensor is still firing even when the screen is off. When I run the same
 program with out the USB connected the sensor stop a few seconds after the
 screen goes dark. I wonder if there is a work around here waiting to be
 found. Can you fool the phone into thinking it is connected to USB?

 --
 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

-- 
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: Accelerometer vs Gravity Sensor in game code?

2011-08-28 Thread nadam
 They could be referring to a gyroscope sensor.
Probably not. G-sensor is usually referring to the accelerometer and
has to do with measuring the gravity combined with the linear
acceleration of the device. The gyroscope is for measuring rotational
speed.

For tilt based games such as Doodle Jump and Labyrinth, the
accelerometer is perfect. First person 3D games and augmented reality
apps might want to use the gyroscope (possibly combined with
accelerometer and compass) for higher accuracy.

On 27 Aug, 21:21, Christopher Van Kirk christopher.vank...@gmail.com
wrote:
 They could be referring to a gyroscope sensor. The new Samsung devices
 have those now in addition to the accelerometer.

 On 8/28/2011 12:28 AM, Jim Graham wrote:







  When writing game code, what (if anything) is the difference between
  the accelerometer, G-Sensor, and Gravity Sensor?  I'd assumed that
  they were all different names for the same thing, until I pulled
  up specs on my Motorola Bravo (MB520), and found a device id for
  the accelerometer, an Unsupported for the Gravity Sensor, and
  no mention of a G-Sensor (which I'm guessing is a Gravity Sensor).

  Now I'm not so sure.  So, when writing game code, is there any real
  difference?  Are they basically the same thing?  Or are they
  completely different sensors?

  In trying to find the answer myself, I found a lot of discussios
  that went like this:

      An accelerometer is [this], and a G-sensor is [that].
      An accelerometer is [that], and a G-sensor is [this].
      An accelerometer is [that], and a G-sensor is [this].
      An accelerometer and a G-sensor are the same thing.
      An accelerometer is [that], and a G-sensor is [this].
      An accelerometer is [this], and a G-sensor is [that].
      An accelerometer is [that], and a G-sensor is [this].
      An accelerometer and a G-sensor are the same thing.
      An accelerometer is [this], and a G-sensor is [that].

  and so on, ad nauseum

  Is there an authoritative answer out there?

  Later,
      --jim

-- 
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: Accelerometer vs Gravity Sensor in game code?

2011-08-28 Thread Adam Ratana

On Saturday, August 27, 2011 12:28:59 PM UTC-4, Spooky wrote:

 When writing game code, what (if anything) is the difference between
 the accelerometer, G-Sensor, and Gravity Sensor?  I'd assumed that
 they were all different names for the same thing, until I pulled
 up specs on my Motorola Bravo (MB520), and found a device id for
 the accelerometer, an Unsupported for the Gravity Sensor, and
 no mention of a G-Sensor (which I'm guessing is a Gravity Sensor).

 Now I'm not so sure.  So, when writing game code, is there any real
 difference?  Are they basically the same thing?  Or are they
 completely different sensors?


You can probably safely assume that most devices will have an accelerometer, 
which measures gravity on 3 axes, as well as a compass.  Newer devices may 
have gyroscopes which can be more helpful for detecting different types of 
motion.

Here's a very helpful link which may describe more of what goes on with the 
sensors in phones, and which to use when, when available:

Sensor Fusion on Android Devices:
http://www.youtube.com/watch?v=C7JQ7Rpwn2k

 

-- 
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: Accelerometer vs Gravity Sensor in game code?

2011-08-28 Thread Jim Graham
On Sun, Aug 28, 2011 at 08:44:45AM -0700, Adam Ratana wrote:

 Here's a very helpful link which may describe more of what goes on with
 the sensors in phones, and which to use when, when available:
 
 Sensor Fusion on Android Devices:
 http://www.youtube.com/watch?v=C7JQ7Rpwn2k

Thanks.  I'll take a look at it.

Later,
   --jim

-- 
73 DE N5IAL (/4)MiSTie #49997   Running FreeBSD 7.0 
spooky1...@gmail.com ICBM/Hurricane: 30.44406N 86.59909W

   Someone ever tries to kill you, you try to kill 'em right back!
   --Mal (Firefly, 1x03, Our Mrs. Reynolds)

Android Apps Listing at http://www.jstrack.org/barcodes.html

-- 
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: Accelerometer problem. Compass not rotating.

2011-06-14 Thread Raghav Sood
I noticed that too but the book I am learning from doesn't say anywhere that
you need it.

On Wed, Jun 15, 2011 at 10:43 AM, gjs garyjamessi...@gmail.com wrote:

 Hi,

 I don't see any reference to the compass sensor in your code, just a
 few references to 'bearing' how is it set ?

 Regards

 On Jun 15, 3:39 am, Raghav Sood raghavs...@gmail.com wrote:
  Hi all,
 
  According to the book I am learning from the following code should
  create a sad looking, but working, compass. All I have managed to get
  is the sad lookout of it. The compass draws correctly but doesn't
  rotate. I am testing it on a real device with a accelerometer. The
  rest of the files in the project have nothing to do with the rotation.
  Everything happens in this class. Could anyone point me to my mistake?
   Any help would be appreciated.
 
  package com.raghavsood.compass;
 
  import android.content.Context;
  import android.graphics.*;
  import android.view.*;
  import android.util.AttributeSet;
  import android.content.res.Resources;
 
  public class CompassView extends View {
 
private Paint markerPaint;
private Paint textPaint;
private Paint circlePaint;
private String northString;
private String eastString;
private String southString;
private String westString;
private int textHeight;
 
private float bearing;
public void setBearing(float _bearing) {
  bearing = _bearing;
}
public float getBearing() {
  return bearing;
}
 
public CompassView(Context context) {
  super(context);
  initCompassView();
}
 
public CompassView(Context context, AttributeSet attrs) {
  super(context, attrs);
  initCompassView();
}
 
public CompassView(Context context,
   AttributeSet ats,
   int defaultStyle) {
  super(context, ats, defaultStyle);
  initCompassView();
}
 
protected void initCompassView() {
  setFocusable(true);
 
  Resources r = this.getResources();
 
  circlePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
  circlePaint.setColor(r.getColor(R.color.background_color));
  circlePaint.setStrokeWidth(1);
  circlePaint.setStyle(Paint.Style.FILL_AND_STROKE);
 
  northString = r.getString(R.string.cardinal_north);
  eastString = r.getString(R.string.cardinal_east);
  southString = r.getString(R.string.cardinal_south);
  westString = r.getString(R.string.cardinal_west);
 
  textPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
  textPaint.setColor(r.getColor(R.color.text_color));
 
  textHeight = (int)textPaint.measureText(yY);
 
  markerPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
  markerPaint.setColor(r.getColor(R.color.marker_color));
}
 
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  // The compass is a circle that fills as much space as possible.
  // Set the measured dimensions by figuring out the shortest boundary,
  // height or width.
  int measuredWidth = measure(widthMeasureSpec);
  int measuredHeight = measure(heightMeasureSpec);
 
  int d = Math.min(measuredWidth, measuredHeight);
 
  setMeasuredDimension(d, d);
}
 
private int measure(int measureSpec) {
  int result = 0;
 
  // Decode the measurement specifications.
  int specMode = MeasureSpec.getMode(measureSpec);
  int specSize = MeasureSpec.getSize(measureSpec);
 
  if (specMode == MeasureSpec.UNSPECIFIED) {
// Return a default size of 200 if no bounds are specified.
result = 200;
  } else {
// As you want to fill the available space
// always return the full available bounds.
result = specSize;
  }
  return result;
}
 
@Override
protected void onDraw(Canvas canvas) {
  int px = getMeasuredWidth() / 2;
  int py = getMeasuredHeight() /2 ;
 
  int radius = Math.min(px, py);
  // Draw the background
  canvas.drawCircle(px, py, radius, circlePaint);
  // Rotate our perspective so that the ‘top’ is
  // facing the current bearing.
  canvas.save();
  canvas.rotate(-bearing, px, py);
  int textWidth = (int)textPaint.measureText(W);
  int cardinalX = px-textWidth/2;
  int cardinalY = py-radius+textHeight;
 
  // Draw the marker every 15 degrees and text every 45.
  for (int i = 0; i  24; i++) {
// Draw a marker.
canvas.drawLine(px, py-radius, px, py-radius+10, markerPaint);
 
canvas.save();
canvas.translate(0, textHeight);
 
// Draw the cardinal points
if (i % 6 == 0) {
  String dirString = ;
  switch (i) {
case(0)  : {
 dirString = northString;
 int arrowY = 2*textHeight;
 canvas.drawLine(px, arrowY, px-5, 3*textHeight,
 markerPaint);
 canvas.drawLine(px, 

[android-developers] Re: Accelerometer problem. Compass not rotating.

2011-06-14 Thread gjs
Hi,

I don't see any reference to the compass sensor in your code, just a
few references to 'bearing' how is it set ?

Regards

On Jun 15, 3:39 am, Raghav Sood raghavs...@gmail.com wrote:
 Hi all,

 According to the book I am learning from the following code should
 create a sad looking, but working, compass. All I have managed to get
 is the sad lookout of it. The compass draws correctly but doesn't
 rotate. I am testing it on a real device with a accelerometer. The
 rest of the files in the project have nothing to do with the rotation.
 Everything happens in this class. Could anyone point me to my mistake?
  Any help would be appreciated.

 package com.raghavsood.compass;

 import android.content.Context;
 import android.graphics.*;
 import android.view.*;
 import android.util.AttributeSet;
 import android.content.res.Resources;

 public class CompassView extends View {

   private Paint markerPaint;
   private Paint textPaint;
   private Paint circlePaint;
   private String northString;
   private String eastString;
   private String southString;
   private String westString;
   private int textHeight;

   private float bearing;
   public void setBearing(float _bearing) {
     bearing = _bearing;
   }
   public float getBearing() {
     return bearing;
   }

   public CompassView(Context context) {
     super(context);
     initCompassView();
   }

   public CompassView(Context context, AttributeSet attrs) {
     super(context, attrs);
     initCompassView();
   }

   public CompassView(Context context,
                      AttributeSet ats,
                      int defaultStyle) {
     super(context, ats, defaultStyle);
     initCompassView();
   }

   protected void initCompassView() {
     setFocusable(true);

     Resources r = this.getResources();

     circlePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
     circlePaint.setColor(r.getColor(R.color.background_color));
     circlePaint.setStrokeWidth(1);
     circlePaint.setStyle(Paint.Style.FILL_AND_STROKE);

     northString = r.getString(R.string.cardinal_north);
     eastString = r.getString(R.string.cardinal_east);
     southString = r.getString(R.string.cardinal_south);
     westString = r.getString(R.string.cardinal_west);

     textPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
     textPaint.setColor(r.getColor(R.color.text_color));

     textHeight = (int)textPaint.measureText(yY);

     markerPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
     markerPaint.setColor(r.getColor(R.color.marker_color));
   }

   @Override
   protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
     // The compass is a circle that fills as much space as possible.
     // Set the measured dimensions by figuring out the shortest boundary,
     // height or width.
     int measuredWidth = measure(widthMeasureSpec);
     int measuredHeight = measure(heightMeasureSpec);

     int d = Math.min(measuredWidth, measuredHeight);

     setMeasuredDimension(d, d);
   }

   private int measure(int measureSpec) {
     int result = 0;

     // Decode the measurement specifications.
     int specMode = MeasureSpec.getMode(measureSpec);
     int specSize = MeasureSpec.getSize(measureSpec);

     if (specMode == MeasureSpec.UNSPECIFIED) {
       // Return a default size of 200 if no bounds are specified.
       result = 200;
     } else {
       // As you want to fill the available space
       // always return the full available bounds.
       result = specSize;
     }
     return result;
   }

   @Override
   protected void onDraw(Canvas canvas) {
     int px = getMeasuredWidth() / 2;
     int py = getMeasuredHeight() /2 ;

     int radius = Math.min(px, py);
     // Draw the background
     canvas.drawCircle(px, py, radius, circlePaint);
     // Rotate our perspective so that the ‘top’ is
     // facing the current bearing.
     canvas.save();
     canvas.rotate(-bearing, px, py);
     int textWidth = (int)textPaint.measureText(W);
     int cardinalX = px-textWidth/2;
     int cardinalY = py-radius+textHeight;

     // Draw the marker every 15 degrees and text every 45.
     for (int i = 0; i  24; i++) {
       // Draw a marker.
       canvas.drawLine(px, py-radius, px, py-radius+10, markerPaint);

       canvas.save();
       canvas.translate(0, textHeight);

       // Draw the cardinal points
       if (i % 6 == 0) {
         String dirString = ;
         switch (i) {
           case(0)  : {
                        dirString = northString;
                        int arrowY = 2*textHeight;
                        canvas.drawLine(px, arrowY, px-5, 3*textHeight,
                                        markerPaint);
                        canvas.drawLine(px, arrowY, px+5, 3*textHeight,
                                        markerPaint);
                        break;
                      }
           case(6)  : dirString = eastString; break;
           case(12) : dirString = southString; break;
           case(18) : dirString = westString; break;
         }
        

[android-developers] Re: Accelerometer and the samplin rate

2011-01-14 Thread ip332
First of all it all device dependent because SENSOR_DELAY_FASTEST has
value 0ms in Android git but 10ms - Samsung Galaxy S.
Using 0ms should result in close to 100% CPU usage so some sensors
drivers have internal logic to prevent such case and add some delay
inside.

On the other side sampling rate is the frequency of measurements
when it seems like you are trying to check how often do you get
SensorEvent.
You should use timestamps inside sensor event if you are interested in
the stability of the sampling rate.
With respect to the unstable rate you get updates from the
SensorManager - this is not a bug, but a feature (explicitly described
in the SensorManager documentation).


On Jan 13, 12:35 am, outi outi1...@googlemail.com wrote:
 Hello,

 does anybody know, why the sensor sampling rate is fluctuating between
 85 and 115 Hertz [Hz] ?
 I tested my accleretation sensor app up to 60 seconds. And I
 calculated the mean sampling rate. In any continous I get an another
 mean sampling rate...

 I'm using the SENSOR_DELAY_FASTET constant:

 sensorManager.registerListener(accelerationListener, sensor,
 SensorManager.SENSOR_DELAY_FASTEST);

 Thank you for your replies!

-- 
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: Accelerometer not working when screen turns off

2010-08-26 Thread Jonathan Weinberg
I have not been able to test yet with an HTC device running Froyo.  Adding
to the list, I am getting reports that Samsung is having some trouble with
this too.

On Wed, Aug 25, 2010 at 6:38 AM, Furiaceca ctacc...@gmail.com wrote:

 Hello,
 I tried few days ago with my HTC Desire and the official Froyo
 release ... but when the screen is off the sensor never provide any
 data: I use Partial Wake lock but this doesn't work.
 Have you success by using Partial Wake lock? Which smartphone are you
 using?

 Thanks a lot
 Carlo

 On 16 Lug, 17:06, Bret Foreman bret.fore...@gmail.com wrote:
  My application will run extensively in partial wakelock mode and I'm
  very curious to see what standby power consumption consequences that
  has for various popular phones. Maybe we should start a thread just
  for that purpose where people can post their observations of battery
  life in this mode for various phones.

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 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@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: Accelerometer not working when screen turns off

2010-08-25 Thread Furiaceca
Hello,
I tried few days ago with my HTC Desire and the official Froyo
release ... but when the screen is off the sensor never provide any
data: I use Partial Wake lock but this doesn't work.
Have you success by using Partial Wake lock? Which smartphone are you
using?

Thanks a lot
Carlo

On 16 Lug, 17:06, Bret Foreman bret.fore...@gmail.com wrote:
 My application will run extensively in partial wakelock mode and I'm
 very curious to see what standby power consumption consequences that
 has for various popular phones. Maybe we should start a thread just
 for that purpose where people can post their observations of battery
 life in this mode for various phones.

-- 
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: Accelerometer not working when screen turns off

2010-07-16 Thread Bret Foreman
My application will run extensively in partial wakelock mode and I'm
very curious to see what standby power consumption consequences that
has for various popular phones. Maybe we should start a thread just
for that purpose where people can post their observations of battery
life in this mode for various phones.

-- 
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: Accelerometer not working when screen turns off

2010-05-27 Thread Jonathan
I heard back from the developer at Google.  This should be fixed
starting in 2.2.  :-)

A partial wake lock will be required in order to keep the sensors
running when the CPU goes in standby, but the screen turning off will
no longer stop the sensors from running.

Although I would prefer not to have to hold the wake lock to keep the
sensors running in standby, this is still great news!


On May 26, 10:44 pm, Jonathan jharrisweinb...@gmail.com wrote:
 FYI - it looks like Issue 3708 referenced above has now been
 addressed!  I am reaching out to the developer to see if we can get
 further clarification as to how exactly this has been addressed and in
 which release.  Encouraging news!

 On May 11, 7:11 pm, Jonathan jharrisweinb...@gmail.com wrote:



  I'm hoping we don't start debating the usefulness of this issue here.
  It has been debated quite enough in other threads and on other forums.
  All I would like at this point is some official response from someone
  who knows why the behavior is what it is. If it is firmware and it is
  controlled by the phone manufacturers, then that is an acceptable
  answer. I'm inclined to think that it is not a firmware issue since
  this was supposedly fixed in an earlier version of Android, only to
  have varying results after that. But enough speculating...

  On May 11, 7:02 pm, mike enervat...@gmail.com wrote:

   On 05/11/2010 03:56 PM, Kelly wrote:

I hear the word 'firmware' being used, which is closely monitored and
work on by the manufacturer (HTC, Motorola, Sony Ericsson). I can
unserstand why google would have nothing to say, since this is likely
100% controlled by the phone manufacturer who wants to extend battery
life by turning off peripheral components in sleep state. My advice is
to work around it.

   I'm sorry, this is silly. The only way to work around it is to
   lock the display on! Which completely and utterly defeats any
   battery savings they might have got.

   I'm perfectly happy with the accelerometer by default being
   off when the display is being slept, but there needs to be a
   SDK programmatic way to turn it on for apps that need that
   functionality. Please don't fall for Apple nanny-state silliness.

   Mike

Cheers

On May 11, 2:03 pm, Jordan Frankjordan.w.fr...@gmail.com  wrote:

Holy crap, this again?!?

I just discovered this because we ordered four Nexus Ones to do some
demos of our research on the Discovery Channel. All of a sudden what
was working perfectly on the G1 stopped working altogether on the
Nexus One. If you read the archives of this list, you'll see that I've
harped about this a lot in the past, and was delighted when it was
changed in Cupcake. Now they've gone and broke it again. And I just
spent hundreds shipping these things to Canada.

Argggh. So Google, are you going to remain silent on this issue again,
or will you let us know at the very least why this decision was made.
You've pissed off a lot of developers. Not to mention that your Nexus
One phone won't be featured on the Discovery Channel bit that is being
filmed tomorrow. Tough luck.

Cheers,
Jordan

On Apr 26, 8:25 pm, mikeenervat...@gmail.com  wrote:

I'll third that on wanting to know what's up. Some insight as
to whether this is a hardware issue on some platforms would be
pretty nice too... the same thing happens on the iPhone but getting
any insight from them is impossible.

Mike

On 04/24/2010 09:14 AM, Jonathan wrote:

Thanks Lance.  I saw that... it is one of the highest ranked issues
out there and the comments are being abused quite a bit, but there
does not seem to be any response from Google about whether or not 
they
plan to correct this going forward, or if they feel it is something
that even needs to be corrected.

I've been trying everything I can think of to find some kind of
workaround, but so far have failed to do so.  It would be great to 
get
a response from one of the Google engineers on this and I think it
would hopefully at least put the issue to rest, even if the response
is that they do not plan to change this going forward.  I hope that 
is
not the answer, but at least we would know.

The odd thing is that thesensorsappear to behave somewhat
differently depending on the actual device.  For example, there are
different behaviors between the Droid and the Nexus One, despite the
fact that they are both using Android 2.1.  So possibly some of the
issues are related to the variations in the hardwaresensors
themselves, but that is just more speculation.

Dianne, if you are out there, I think there are a lot of people that
would like to get a response on this one.  Thank you!!

On Apr 24, 10:14 am, Lance Naneklna...@gmail.com    wrote:

   http://code.google.com/p/android/issues/detail?id=3708

On Apr 13, 6:32 am, 

[android-developers] Re: Accelerometer not working when screen turns off

2010-05-27 Thread BobG
Its the backlight that sucks coulombs. If you can dim that way down,
you're golden.

-- 
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: Accelerometer not working when screen turns off

2010-05-26 Thread Jonathan
FYI - it looks like Issue 3708 referenced above has now been
addressed!  I am reaching out to the developer to see if we can get
further clarification as to how exactly this has been addressed and in
which release.  Encouraging news!

On May 11, 7:11 pm, Jonathan jharrisweinb...@gmail.com wrote:
 I'm hoping we don't start debating the usefulness of this issue here.
 It has been debated quite enough in other threads and on other forums.
 All I would like at this point is some official response from someone
 who knows why the behavior is what it is. If it is firmware and it is
 controlled by the phone manufacturers, then that is an acceptable
 answer. I'm inclined to think that it is not a firmware issue since
 this was supposedly fixed in an earlier version of Android, only to
 have varying results after that. But enough speculating...

 On May 11, 7:02 pm, mike enervat...@gmail.com wrote:





  On 05/11/2010 03:56 PM, Kelly wrote:

   I hear the word 'firmware' being used, which is closely monitored and
   work on by the manufacturer (HTC, Motorola, Sony Ericsson). I can
   unserstand why google would have nothing to say, since this is likely
   100% controlled by the phone manufacturer who wants to extend battery
   life by turning off peripheral components in sleep state. My advice is
   to work around it.

  I'm sorry, this is silly. The only way to work around it is to
  lock the display on! Which completely and utterly defeats any
  battery savings they might have got.

  I'm perfectly happy with the accelerometer by default being
  off when the display is being slept, but there needs to be a
  SDK programmatic way to turn it on for apps that need that
  functionality. Please don't fall for Apple nanny-state silliness.

  Mike

   Cheers

   On May 11, 2:03 pm, Jordan Frankjordan.w.fr...@gmail.com  wrote:

   Holy crap, this again?!?

   I just discovered this because we ordered four Nexus Ones to do some
   demos of our research on the Discovery Channel. All of a sudden what
   was working perfectly on the G1 stopped working altogether on the
   Nexus One. If you read the archives of this list, you'll see that I've
   harped about this a lot in the past, and was delighted when it was
   changed in Cupcake. Now they've gone and broke it again. And I just
   spent hundreds shipping these things to Canada.

   Argggh. So Google, are you going to remain silent on this issue again,
   or will you let us know at the very least why this decision was made.
   You've pissed off a lot of developers. Not to mention that your Nexus
   One phone won't be featured on the Discovery Channel bit that is being
   filmed tomorrow. Tough luck.

   Cheers,
   Jordan

   On Apr 26, 8:25 pm, mikeenervat...@gmail.com  wrote:

   I'll third that on wanting to know what's up. Some insight as
   to whether this is a hardware issue on some platforms would be
   pretty nice too... the same thing happens on the iPhone but getting
   any insight from them is impossible.

   Mike

   On 04/24/2010 09:14 AM, Jonathan wrote:

   Thanks Lance.  I saw that... it is one of the highest ranked issues
   out there and the comments are being abused quite a bit, but there
   does not seem to be any response from Google about whether or not they
   plan to correct this going forward, or if they feel it is something
   that even needs to be corrected.

   I've been trying everything I can think of to find some kind of
   workaround, but so far have failed to do so.  It would be great to get
   a response from one of the Google engineers on this and I think it
   would hopefully at least put the issue to rest, even if the response
   is that they do not plan to change this going forward.  I hope that is
   not the answer, but at least we would know.

   The odd thing is that thesensorsappear to behave somewhat
   differently depending on the actual device.  For example, there are
   different behaviors between the Droid and the Nexus One, despite the
   fact that they are both using Android 2.1.  So possibly some of the
   issues are related to the variations in the hardwaresensors
   themselves, but that is just more speculation.

   Dianne, if you are out there, I think there are a lot of people that
   would like to get a response on this one.  Thank you!!

   On Apr 24, 10:14 am, Lance Naneklna...@gmail.com    wrote:

  http://code.google.com/p/android/issues/detail?id=3708

   On Apr 13, 6:32 am, Jonathanjharrisweinb...@gmail.com    wrote:

   As I understand it, there seems to have been a change in the OS that
   prevents the accelerometer from running when the screen turns off and
   the phone CPU goes into its power saving state.  Can this be
   confirmed?  I have gotten around this by using a wake lock, but this
   is a much less than ideal solution as it drains a lot of battery.

   If the accelerometer was disabled in low power mode to save the
   battery, it may very well have the opposite effect in many cases, 
   such
   as 

[android-developers] Re: Accelerometer not working when screen turns off

2010-05-11 Thread Jordan Frank
Holy crap, this again?!?

I just discovered this because we ordered four Nexus Ones to do some
demos of our research on the Discovery Channel. All of a sudden what
was working perfectly on the G1 stopped working altogether on the
Nexus One. If you read the archives of this list, you'll see that I've
harped about this a lot in the past, and was delighted when it was
changed in Cupcake. Now they've gone and broke it again. And I just
spent hundreds shipping these things to Canada.

Argggh. So Google, are you going to remain silent on this issue again,
or will you let us know at the very least why this decision was made.
You've pissed off a lot of developers. Not to mention that your Nexus
One phone won't be featured on the Discovery Channel bit that is being
filmed tomorrow. Tough luck.

Cheers,
Jordan

On Apr 26, 8:25 pm, mike enervat...@gmail.com wrote:
 I'll third that on wanting to know what's up. Some insight as
 to whether this is a hardware issue on some platforms would be
 pretty nice too... the same thing happens on the iPhone but getting
 any insight from them is impossible.

 Mike

 On 04/24/2010 09:14 AM, Jonathan wrote:





  Thanks Lance.  I saw that... it is one of the highest ranked issues
  out there and the comments are being abused quite a bit, but there
  does not seem to be any response from Google about whether or not they
  plan to correct this going forward, or if they feel it is something
  that even needs to be corrected.

  I've been trying everything I can think of to find some kind of
  workaround, but so far have failed to do so.  It would be great to get
  a response from one of the Google engineers on this and I think it
  would hopefully at least put the issue to rest, even if the response
  is that they do not plan to change this going forward.  I hope that is
  not the answer, but at least we would know.

  The odd thing is that thesensorsappear to behave somewhat
  differently depending on the actual device.  For example, there are
  different behaviors between the Droid and the Nexus One, despite the
  fact that they are both using Android 2.1.  So possibly some of the
  issues are related to the variations in the hardwaresensors
  themselves, but that is just more speculation.

  Dianne, if you are out there, I think there are a lot of people that
  would like to get a response on this one.  Thank you!!

  On Apr 24, 10:14 am, Lance Naneklna...@gmail.com  wrote:

 http://code.google.com/p/android/issues/detail?id=3708

  On Apr 13, 6:32 am, Jonathanjharrisweinb...@gmail.com  wrote:

  As I understand it, there seems to have been a change in the OS that
  prevents the accelerometer from running when the screen turns off and
  the phone CPU goes into its power saving state.  Can this be
  confirmed?  I have gotten around this by using a wake lock, but this
  is a much less than ideal solution as it drains a lot of battery.

  If the accelerometer was disabled in low power mode to save the
  battery, it may very well have the opposite effect in many cases, such
  as mine. A partial wake lock seems to be required to keep it running,
  which is obviously much worse than if just the accelerometer were
  running without the need for the wake lock.

  Are there any other workarounds anyone knows of to getting
  accelerometer values while the phone is in low power mode?  Also, are
  there any plans to change this in future versions of the OS?  If there
  are no plans to change this, I would definitely like to petition for
  this to be changed.

  Thoughts?  Ideas?  Workarounds?  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@googlegroups.com
  To unsubscribe from this group, send email to
  android-developers+unsubscr...@googlegroups.com
  For more options, visit this group 
  athttp://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@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group 
 athttp://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@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: Accelerometer not working when screen turns off

2010-05-11 Thread Jonathan
I'm hoping we don't start debating the usefulness of this issue here.
It has been debated quite enough in other threads and on other forums.
All I would like at this point is some official response from someone
who knows why the behavior is what it is. If it is firmware and it is
controlled by the phone manufacturers, then that is an acceptable
answer. I'm inclined to think that it is not a firmware issue since
this was supposedly fixed in an earlier version of Android, only to
have varying results after that. But enough speculating...

On May 11, 7:02 pm, mike enervat...@gmail.com wrote:
 On 05/11/2010 03:56 PM, Kelly wrote:

  I hear the word 'firmware' being used, which is closely monitored and
  work on by the manufacturer (HTC, Motorola, Sony Ericsson). I can
  unserstand why google would have nothing to say, since this is likely
  100% controlled by the phone manufacturer who wants to extend battery
  life by turning off peripheral components in sleep state. My advice is
  to work around it.

 I'm sorry, this is silly. The only way to work around it is to
 lock the display on! Which completely and utterly defeats any
 battery savings they might have got.

 I'm perfectly happy with the accelerometer by default being
 off when the display is being slept, but there needs to be a
 SDK programmatic way to turn it on for apps that need that
 functionality. Please don't fall for Apple nanny-state silliness.

 Mike





  Cheers

  On May 11, 2:03 pm, Jordan Frankjordan.w.fr...@gmail.com  wrote:

  Holy crap, this again?!?

  I just discovered this because we ordered four Nexus Ones to do some
  demos of our research on the Discovery Channel. All of a sudden what
  was working perfectly on the G1 stopped working altogether on the
  Nexus One. If you read the archives of this list, you'll see that I've
  harped about this a lot in the past, and was delighted when it was
  changed in Cupcake. Now they've gone and broke it again. And I just
  spent hundreds shipping these things to Canada.

  Argggh. So Google, are you going to remain silent on this issue again,
  or will you let us know at the very least why this decision was made.
  You've pissed off a lot of developers. Not to mention that your Nexus
  One phone won't be featured on the Discovery Channel bit that is being
  filmed tomorrow. Tough luck.

  Cheers,
  Jordan

  On Apr 26, 8:25 pm, mikeenervat...@gmail.com  wrote:

  I'll third that on wanting to know what's up. Some insight as
  to whether this is a hardware issue on some platforms would be
  pretty nice too... the same thing happens on the iPhone but getting
  any insight from them is impossible.

  Mike

  On 04/24/2010 09:14 AM, Jonathan wrote:

  Thanks Lance.  I saw that... it is one of the highest ranked issues
  out there and the comments are being abused quite a bit, but there
  does not seem to be any response from Google about whether or not they
  plan to correct this going forward, or if they feel it is something
  that even needs to be corrected.

  I've been trying everything I can think of to find some kind of
  workaround, but so far have failed to do so.  It would be great to get
  a response from one of the Google engineers on this and I think it
  would hopefully at least put the issue to rest, even if the response
  is that they do not plan to change this going forward.  I hope that is
  not the answer, but at least we would know.

  The odd thing is that thesensorsappear to behave somewhat
  differently depending on the actual device.  For example, there are
  different behaviors between the Droid and the Nexus One, despite the
  fact that they are both using Android 2.1.  So possibly some of the
  issues are related to the variations in the hardwaresensors
  themselves, but that is just more speculation.

  Dianne, if you are out there, I think there are a lot of people that
  would like to get a response on this one.  Thank you!!

  On Apr 24, 10:14 am, Lance Naneklna...@gmail.com    wrote:

 http://code.google.com/p/android/issues/detail?id=3708

  On Apr 13, 6:32 am, Jonathanjharrisweinb...@gmail.com    wrote:

  As I understand it, there seems to have been a change in the OS that
  prevents the accelerometer from running when the screen turns off and
  the phone CPU goes into its power saving state.  Can this be
  confirmed?  I have gotten around this by using a wake lock, but this
  is a much less than ideal solution as it drains a lot of battery.

  If the accelerometer was disabled in low power mode to save the
  battery, it may very well have the opposite effect in many cases, such
  as mine. A partial wake lock seems to be required to keep it running,
  which is obviously much worse than if just the accelerometer were
  running without the need for the wake lock.

  Are there any other workarounds anyone knows of to getting
  accelerometer values while the phone is in low power mode?  Also, are
  there any plans to change this in future versions of the OS?  If 

Re: [android-developers] Re: Accelerometer not working when screen turns off

2010-04-26 Thread mike

I'll third that on wanting to know what's up. Some insight as
to whether this is a hardware issue on some platforms would be
pretty nice too... the same thing happens on the iPhone but getting
any insight from them is impossible.

Mike

On 04/24/2010 09:14 AM, Jonathan wrote:

Thanks Lance.  I saw that... it is one of the highest ranked issues
out there and the comments are being abused quite a bit, but there
does not seem to be any response from Google about whether or not they
plan to correct this going forward, or if they feel it is something
that even needs to be corrected.

I've been trying everything I can think of to find some kind of
workaround, but so far have failed to do so.  It would be great to get
a response from one of the Google engineers on this and I think it
would hopefully at least put the issue to rest, even if the response
is that they do not plan to change this going forward.  I hope that is
not the answer, but at least we would know.

The odd thing is that the sensors appear to behave somewhat
differently depending on the actual device.  For example, there are
different behaviors between the Droid and the Nexus One, despite the
fact that they are both using Android 2.1.  So possibly some of the
issues are related to the variations in the hardware sensors
themselves, but that is just more speculation.

Dianne, if you are out there, I think there are a lot of people that
would like to get a response on this one.  Thank you!!



On Apr 24, 10:14 am, Lance Naneklna...@gmail.com  wrote:
   

http://code.google.com/p/android/issues/detail?id=3708

On Apr 13, 6:32 am, Jonathanjharrisweinb...@gmail.com  wrote:





 

As I understand it, there seems to have been a change in the OS that
prevents the accelerometer from running when the screen turns off and
the phone CPU goes into its power saving state.  Can this be
confirmed?  I have gotten around this by using a wake lock, but this
is a much less than ideal solution as it drains a lot of battery.
   
 

If the accelerometer was disabled in low power mode to save the
battery, it may very well have the opposite effect in many cases, such
as mine. A partial wake lock seems to be required to keep it running,
which is obviously much worse than if just the accelerometer were
running without the need for the wake lock.
   
 

Are there any other workarounds anyone knows of to getting
accelerometer values while the phone is in low power mode?  Also, are
there any plans to change this in future versions of the OS?  If there
are no plans to change this, I would definitely like to petition for
this to be changed.
   
 

Thoughts?  Ideas?  Workarounds?  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@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group 
athttp://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@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: Accelerometer not working when screen turns off

2010-04-24 Thread Lance Nanek
http://code.google.com/p/android/issues/detail?id=3708

On Apr 13, 6:32 am, Jonathan jharrisweinb...@gmail.com wrote:
 As I understand it, there seems to have been a change in the OS that
 prevents the accelerometer from running when the screen turns off and
 the phone CPU goes into its power saving state.  Can this be
 confirmed?  I have gotten around this by using a wake lock, but this
 is a much less than ideal solution as it drains a lot of battery.

 If the accelerometer was disabled in low power mode to save the
 battery, it may very well have the opposite effect in many cases, such
 as mine. A partial wake lock seems to be required to keep it running,
 which is obviously much worse than if just the accelerometer were
 running without the need for the wake lock.

 Are there any other workarounds anyone knows of to getting
 accelerometer values while the phone is in low power mode?  Also, are
 there any plans to change this in future versions of the OS?  If there
 are no plans to change this, I would definitely like to petition for
 this to be changed.

 Thoughts?  Ideas?  Workarounds?  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@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: Accelerometer not working when screen turns off

2010-04-24 Thread Jonathan
Thanks Lance.  I saw that... it is one of the highest ranked issues
out there and the comments are being abused quite a bit, but there
does not seem to be any response from Google about whether or not they
plan to correct this going forward, or if they feel it is something
that even needs to be corrected.

I've been trying everything I can think of to find some kind of
workaround, but so far have failed to do so.  It would be great to get
a response from one of the Google engineers on this and I think it
would hopefully at least put the issue to rest, even if the response
is that they do not plan to change this going forward.  I hope that is
not the answer, but at least we would know.

The odd thing is that the sensors appear to behave somewhat
differently depending on the actual device.  For example, there are
different behaviors between the Droid and the Nexus One, despite the
fact that they are both using Android 2.1.  So possibly some of the
issues are related to the variations in the hardware sensors
themselves, but that is just more speculation.

Dianne, if you are out there, I think there are a lot of people that
would like to get a response on this one.  Thank you!!



On Apr 24, 10:14 am, Lance Nanek lna...@gmail.com wrote:
 http://code.google.com/p/android/issues/detail?id=3708

 On Apr 13, 6:32 am, Jonathan jharrisweinb...@gmail.com wrote:





  As I understand it, there seems to have been a change in the OS that
  prevents the accelerometer from running when the screen turns off and
  the phone CPU goes into its power saving state.  Can this be
  confirmed?  I have gotten around this by using a wake lock, but this
  is a much less than ideal solution as it drains a lot of battery.

  If the accelerometer was disabled in low power mode to save the
  battery, it may very well have the opposite effect in many cases, such
  as mine. A partial wake lock seems to be required to keep it running,
  which is obviously much worse than if just the accelerometer were
  running without the need for the wake lock.

  Are there any other workarounds anyone knows of to getting
  accelerometer values while the phone is in low power mode?  Also, are
  there any plans to change this in future versions of the OS?  If there
  are no plans to change this, I would definitely like to petition for
  this to be changed.

  Thoughts?  Ideas?  Workarounds?  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@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group 
 athttp://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@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: Accelerometer - direction of shake?

2010-04-09 Thread Jason LeBlanc
How much faster?

On Apr 8, 2010 7:32 PM, BobG bobgard...@aol.com wrote:

If you move the phone left and right when looking at the screen, thats
moving in the x axis, so if you take sanples faster than you are
shaking it, as ordained by Mr Nyquist, you will see the accel
increasing, then slowing down, stopping, and accelerating back the
other way. The info you asked for is in there... which way it goes
first... +x direction or -x direction.

--

You received this message because you are subscribed to the Google
Groups Android Developers group...

-- 
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

To unsubscribe, reply using remove me as the subject.


[android-developers] Re: Accelerometer - direction of shake?

2010-04-09 Thread Bob Kerns
The Nyquist theorem states that you need to sample at least 2x the
frequency you are sampling to be able to capture it. However, you'll
also get various spurious beat signals which can be large compared to
the actual signal if you try to push too close to that 2x. That is, if
you sample 1 Hz faster than 2x the signal, you'll see a spurious 1 Hz
signal due to sampling at different points in the signal's cycle. You
can filter that out, and lose the low-end, or you can increase the
sample rate and filter the input.

This is just about THE most fundamental fact about digitized signal
processing, so it'll be worth reading up on it and getting comfortable
with the implications.

On Apr 9, 3:54 am, Jason LeBlanc jasonalebl...@gmail.com wrote:
 How much faster?

 On Apr 8, 2010 7:32 PM, BobG bobgard...@aol.com wrote:

 If you move the phone left and right when looking at the screen, thats
 moving in the x axis, so if you take sanples faster than you are
 shaking it, as ordained by Mr Nyquist, you will see the accel
 increasing, then slowing down, stopping, and accelerating back the
 other way. The info you asked for is in there... which way it goes
 first... +x direction or -x direction.

 --

 You received this message because you are subscribed to the Google
 Groups Android Developers group...

-- 
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

To unsubscribe, reply using remove me as the subject.


[android-developers] Re: Accelerometer - direction of shake?

2010-04-08 Thread Kumar Bibek
Well, only the accelerometer might not be useful in this scenario. You
should also think on the lines of orientation. If you use only the
accelerometer, obviously you will not get consistent results. Say, if
someone is sleeping or turned up side down. :)

Try searching for some examples. I am sure you will find some.

Thanks and Regards,
Kumar Bibek

On Apr 8, 7:49 pm, Neilz neilhorn...@googlemail.com wrote:
 Hi all. I've been playing with the data given by the accelerometer,
 trying to work out how I can gauge a shake from front to back or side
 to side. This all seems straightforward enough.

 But I'd love to know the direction of the shake. So, if the user is
 shaking backwards and forwards, I want to know if the device is moving
 away from the user, or back towards him/her. I can't find any way of
 telling this.

 Any clues?

-- 
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

To unsubscribe, reply using remove me as the subject.


[android-developers] Re: Accelerometer - direction of shake?

2010-04-08 Thread BobG
If you move the phone left and right when looking at the screen, thats
moving in the x axis, so if you take sanples faster than you are
shaking it, as ordained by Mr Nyquist, you will see the accel
increasing, then slowing down, stopping, and accelerating back the
other way. The info you asked for is in there... which way it goes
first... +x direction or -x direction.

-- 
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

To unsubscribe, reply using remove me as the subject.


Re: [android-developers] Re: accelerometer driver example?

2010-02-10 Thread Robin Getz
On Tue 9 Feb 2010 20:48, Lance Nanek pondered:
 This mentions the accelerometer:
 http://pdk.android.com/online-pdk/guide/sensors.html

Thanks - that helps, but - I'm to understand that there is no kernel/userspace 
API standard for sensors, and that every device manufacture is on their own 
to make up something themselves, and create their 
own /system/lib/libsensors.so?

Poking around I found some qemu sensor files that people seem to base things 
from? but no this is the example that runs on hardware to say what the 
defacto kernel/userspace API is...

Thanks

 On Feb 9, 2:48 pm, Robin Getz rg...@blackfin.uclinux.org wrote:
  On Fri 5 Feb 2010 11:45, Robin Getz pondered:
 
   Where is an example of an accelerometer driver that properly connects
   to the android sensor event API?
 
  http://developer.android.com/reference/android/hardware/SensorEvent.html
 
   We have an accelerometer 
driver -http://patchwork.kernel.org/patch/53645/
   but I expect that it doesn't expose things in /dev the way that the
   rest of Android wants it to - so it isn't going to work. I would like
   to understand what the standard is...
 
   Any pointers appreciated.
 
  Trying android-developers, since android-kernel seems a little dead...
 
  Thanks
  -Robin
 

-- 
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: accelerometer driver example?

2010-02-10 Thread Robin Getz
On Wed 10 Feb 2010 10:19, Robin Getz pondered:
 On Tue 9 Feb 2010 20:48, Lance Nanek pondered:
  This mentions the accelerometer:
  http://pdk.android.com/online-pdk/guide/sensors.html
 
 Thanks - that helps, but - I'm to understand that there is no 
 kernel/userspace 
 API standard for sensors, and that every device manufacture is on their own 
 to make up something themselves, and create their 
 own /system/lib/libsensors.so?
 
 Poking around I found some qemu sensor files that people seem to base things 
 from? but no this is the example that runs on hardware to say what the 
 defacto kernel/userspace API is...

OK - for anyone else looking - I found:

http://gitorious.org/android-on-freerunner/platform_hardware_libhardware/commit/2b5690253dbc4c0be9d05ba15222be3dcb44696a

http://android.git.kernel.org/?p=platform/hardware/libhardware.git;a=blob;f=sensors/sensors_trout.c;h=f3c0b3a51c948291ea8060c650d6be078cedf004;hb=d6054a36475b5ff502b4af78f7d272a713c1a8e7

Any other examples are appreciated.

-Robin



  On Feb 9, 2:48 pm, Robin Getz rg...@blackfin.uclinux.org wrote:
   On Fri 5 Feb 2010 11:45, Robin Getz pondered:
  
Where is an example of an accelerometer driver that properly connects
to the android sensor event API?
  
   http://developer.android.com/reference/android/hardware/SensorEvent.html
  
We have an accelerometer 
 driver -http://patchwork.kernel.org/patch/53645/
but I expect that it doesn't expose things in /dev the way that the
rest of Android wants it to - so it isn't going to work. I would like
to understand what the standard is...
  
Any pointers appreciated.
  
   Trying android-developers, since android-kernel seems a little dead...
  
   Thanks
   -Robin
  
 

-- 
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: accelerometer driver example?

2010-02-09 Thread Robin Getz
On Fri 5 Feb 2010 11:45, Robin Getz pondered:
 Where is an example of an accelerometer driver that properly connects
 to the android sensor event API?
 
 http://developer.android.com/reference/android/hardware/SensorEvent.html
 
 We have an accelerometer driver - http://patchwork.kernel.org/patch/53645/
 but I expect that it doesn't expose things in /dev the way that the
 rest of Android wants it to - so it isn't going to work. I would like
 to understand what the standard is...
 
 Any pointers appreciated.

Trying android-developers, since android-kernel seems a little dead...

Thanks
-Robin

-- 
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: accelerometer driver example?

2010-02-09 Thread Lance Nanek
This mentions the accelerometer:
http://pdk.android.com/online-pdk/guide/sensors.html

On Feb 9, 2:48 pm, Robin Getz rg...@blackfin.uclinux.org wrote:
 On Fri 5 Feb 2010 11:45, Robin Getz pondered:

  Where is an example of an accelerometer driver that properly connects
  to the android sensor event API?

 http://developer.android.com/reference/android/hardware/SensorEvent.html

  We have an accelerometer driver -http://patchwork.kernel.org/patch/53645/
  but I expect that it doesn't expose things in /dev the way that the
  rest of Android wants it to - so it isn't going to work. I would like
  to understand what the standard is...

  Any pointers appreciated.

 Trying android-developers, since android-kernel seems a little dead...

 Thanks
 -Robin

-- 
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: Accelerometer on Motorola Droid

2010-01-19 Thread PhoenixofMT
I can't provide much on this. I'm not a developer, but I may be able
to provide some insight. I've been wanting to find a way to calibrate
the accelerometers on my droid since I installed the tricorder app. It
bugs me that the X and Y axes are off by about .2 ms^-2 in both
orientations. In my searches for such a calibration method, I came
across this post.

The reason the accelerometers never measure zero is that there is
always at least one axis being pulled by gravity. If the device is
lying flat, the Z axis is pointing at (roughly) the center of the
earth and should measure acceleration due to gravity (9.8 ms^-2). The
other axes should be near zero, but the shoddy factory calibration
makes this difficult. The company I work for manufactures marine
inertial navigation systems that use accelerometers, gyros and a 3-
axis electronic compass and I get to calibrate them from time to
time.The way I do this (using a built in program that I've had nothing
to do with) is to set the box on each side and have the calibration
program take 10 readings from the relevant accelerometer, (it also
takes readings from the electronic compass to help with those
measurements, in case you're also working on a compass program). What
I assume, is that the calibration program sets the reading from each
orientation of each axis at +/- 9.2ms^-2. It probably also compares
the differences in magnitudes of the signals from each sensor to
further sharpen the accuracy, since I do not set these things
perfectly vertical for the calibration. As long as the device is held
in the same orientation within the calibration box and the outside of
the box is square, the calibration program can figure it out.

As for using the accelerometers to measure speed changes, I've been
thinking about that to. It would be cool to, perhaps, augment a GPS
speedometer with the accelerometers. Maybe to provide higher
resolution without taxing the GPS receivers? In any case, its pretty
complicated, I'd have to dig out my physics textbook to find the
formulas. Even then it would probably take me a while to wrap my head
around a combination of three axes. Then there is filtering out noise
from, say, the vibrations of a car

Any way, I hope I've been of some help. Good luck, I look forward to
trying out your app.
-- 
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: Accelerometer on Motorola Droid

2010-01-19 Thread TonyDoc
Hi,

As PhoenixofMT said, calibration from factory is poor, but sufficient
for most games and the like. I had to write a similar calibration
routine into my software before I managed to get any realistic figures
from the accelerometer. The user is required to sit the device in the
various orientations, then you need to scale the device provided
accelerometer readings proportionally with your calibrated ranges. I
also found that changes in temperature affects calibration, so I
recommend the user to calibrate the device every time they use the
application :( .

On Jan 17, 11:51 pm, PhoenixofMT jimstanle...@gmail.com wrote:
 I can't provide much on this. I'm not a developer, but I may be able
 to provide some insight. I've been wanting to find a way to calibrate
 the accelerometers on my droid since I installed the tricorder app. It
 bugs me that the X and Y axes are off by about .2 ms^-2 in both
 orientations. In my searches for such a calibration method, I came
 across this post.

 The reason the accelerometers never measure zero is that there is
 always at least one axis being pulled by gravity. If the device is
 lying flat, the Z axis is pointing at (roughly) the center of the
 earth and should measure acceleration due to gravity (9.8 ms^-2). The
 other axes should be near zero, but the shoddy factory calibration
 makes this difficult. The company I work for manufactures marine
 inertial navigation systems that use accelerometers, gyros and a 3-
 axis electronic compass and I get to calibrate them from time to
 time.The way I do this (using a built in program that I've had nothing
 to do with) is to set the box on each side and have the calibration
 program take 10 readings from the relevant accelerometer, (it also
 takes readings from the electronic compass to help with those
 measurements, in case you're also working on a compass program). What
 I assume, is that the calibration program sets the reading from each
 orientation of each axis at +/- 9.2ms^-2. It probably also compares
 the differences in magnitudes of the signals from each sensor to
 further sharpen the accuracy, since I do not set these things
 perfectly vertical for the calibration. As long as the device is held
 in the same orientation within the calibration box and the outside of
 the box is square, the calibration program can figure it out.

 As for using the accelerometers to measure speed changes, I've been
 thinking about that to. It would be cool to, perhaps, augment a GPS
 speedometer with the accelerometers. Maybe to provide higher
 resolution without taxing the GPS receivers? In any case, its pretty
 complicated, I'd have to dig out my physics textbook to find the
 formulas. Even then it would probably take me a while to wrap my head
 around a combination of three axes. Then there is filtering out noise
 from, say, the vibrations of a car

 Any way, I hope I've been of some help. Good luck, I look forward to
 trying out your app.
-- 
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: Accelerometer on Motorola Droid

2010-01-19 Thread TonyDoc
Hi PhoenixofMT,

I've looked into augmenting the accelerometer data with GPS info. The
major hurdle is not the physics, it's the resolution of the GPS data
provided, which is only timestamped to the nearest second! This makes
it extremely difficult the calculate any sort of realistic figures
without a lot of assumptions.
The accelerometer though, after proper calibration, does provide
figures that allow for pretty accurate calculation of acceleration/
speed/distance/power/torque...

On Jan 17, 11:51 pm, PhoenixofMT jimstanle...@gmail.com wrote:
 I can't provide much on this. I'm not a developer, but I may be able
 to provide some insight. I've been wanting to find a way to calibrate
 the accelerometers on my droid since I installed the tricorder app. It
 bugs me that the X and Y axes are off by about .2 ms^-2 in both
 orientations. In my searches for such a calibration method, I came
 across this post.

 The reason the accelerometers never measure zero is that there is
 always at least one axis being pulled by gravity. If the device is
 lying flat, the Z axis is pointing at (roughly) the center of the
 earth and should measure acceleration due to gravity (9.8 ms^-2). The
 other axes should be near zero, but the shoddy factory calibration
 makes this difficult. The company I work for manufactures marine
 inertial navigation systems that use accelerometers, gyros and a 3-
 axis electronic compass and I get to calibrate them from time to
 time.The way I do this (using a built in program that I've had nothing
 to do with) is to set the box on each side and have the calibration
 program take 10 readings from the relevant accelerometer, (it also
 takes readings from the electronic compass to help with those
 measurements, in case you're also working on a compass program). What
 I assume, is that the calibration program sets the reading from each
 orientation of each axis at +/- 9.2ms^-2. It probably also compares
 the differences in magnitudes of the signals from each sensor to
 further sharpen the accuracy, since I do not set these things
 perfectly vertical for the calibration. As long as the device is held
 in the same orientation within the calibration box and the outside of
 the box is square, the calibration program can figure it out.

 As for using the accelerometers to measure speed changes, I've been
 thinking about that to. It would be cool to, perhaps, augment a GPS
 speedometer with the accelerometers. Maybe to provide higher
 resolution without taxing the GPS receivers? In any case, its pretty
 complicated, I'd have to dig out my physics textbook to find the
 formulas. Even then it would probably take me a while to wrap my head
 around a combination of three axes. Then there is filtering out noise
 from, say, the vibrations of a car

 Any way, I hope I've been of some help. Good luck, I look forward to
 trying out your app.
-- 
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: Accelerometer on Motorola Droid

2010-01-19 Thread windstorm
The problem is if you want to filter the acc to get rid of the car
shaking, you first need to decide what's the frequency range of real
value and what's the frequency range of shaking. It's kind of
tricky to set the threshold for the filter.

Any one got good method?

PhoenixofMT wrote:
 I can't provide much on this. I'm not a developer, but I may be able
 to provide some insight. I've been wanting to find a way to calibrate
 the accelerometers on my droid since I installed the tricorder app. It
 bugs me that the X and Y axes are off by about .2 ms^-2 in both
 orientations. In my searches for such a calibration method, I came
 across this post.

 The reason the accelerometers never measure zero is that there is
 always at least one axis being pulled by gravity. If the device is
 lying flat, the Z axis is pointing at (roughly) the center of the
 earth and should measure acceleration due to gravity (9.8 ms^-2). The
 other axes should be near zero, but the shoddy factory calibration
 makes this difficult. The company I work for manufactures marine
 inertial navigation systems that use accelerometers, gyros and a 3-
 axis electronic compass and I get to calibrate them from time to
 time.The way I do this (using a built in program that I've had nothing
 to do with) is to set the box on each side and have the calibration
 program take 10 readings from the relevant accelerometer, (it also
 takes readings from the electronic compass to help with those
 measurements, in case you're also working on a compass program). What
 I assume, is that the calibration program sets the reading from each
 orientation of each axis at +/- 9.2ms^-2. It probably also compares
 the differences in magnitudes of the signals from each sensor to
 further sharpen the accuracy, since I do not set these things
 perfectly vertical for the calibration. As long as the device is held
 in the same orientation within the calibration box and the outside of
 the box is square, the calibration program can figure it out.

 As for using the accelerometers to measure speed changes, I've been
 thinking about that to. It would be cool to, perhaps, augment a GPS
 speedometer with the accelerometers. Maybe to provide higher
 resolution without taxing the GPS receivers? In any case, its pretty
 complicated, I'd have to dig out my physics textbook to find the
 formulas. Even then it would probably take me a while to wrap my head
 around a combination of three axes. Then there is filtering out noise
 from, say, the vibrations of a car

 Any way, I hope I've been of some help. Good luck, I look forward to
 trying out your app.
-- 
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: Accelerometer Reading ranges

2010-01-17 Thread ko5tik


On Jan 16, 9:37 pm, MPower123 michaelh...@gmail.com wrote:

 I just hope theres an API call to set the resolution to 2g or 4g mode.

TANJ - AFAIR, there is no such official API in android SDK (though you
may
be able to hack around or have more luck with  native code )
-- 
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: Accelerometer Reading ranges

2010-01-16 Thread ko5tik
It's accurate enough to steer a toy car on display by tilting
device, but I would not use this sensor to deliver  nuclear warhead
( there definitely better ones )

Of course you can write some filter, but it would be tricky because:
  - your sample times  are not guaranted to be equal (android is not a
realtime environment)
  - you get no more than about 100 samples per seconds
  - you get only 8 bit resolution over 16G
-- 
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: Accelerometer Reading ranges

2010-01-16 Thread ko5tik
I looked at my favorite seller of electronic stuff - while BMA1502
sells for 1.50  from 100+,
there are chips for about $120 apiece ( with much better resolution
and answer times) - guess which
ones will be built into your $300 smartphone ;)
-- 
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: Accelerometer Reading ranges

2010-01-16 Thread MPower123
I was inclined to thinking most of the android phones would come with
relatively the same accelormeter chip.
From what i've read the blackberries and iphone either have a better
chip or better logic has been used to smooth out the signal.

I guess for the most accurate reading I would need to set it to the 2G
mode, for a game i doubt someone will need to really whip the phone
around at 8Gs.

I just hope theres an API call to set the resolution to 2g or 4g mode.


On Jan 16, 1:52 pm, ko5tik kpriblo...@yahoo.com wrote:
 I looked at my favorite seller of electronic stuff - while BMA1502
 sells for 1.50  from 100+,
 there are chips for about $120 apiece ( with much better resolution
 and answer times) - guess which
 ones will be built into your $300 smartphone ;)
-- 
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: Accelerometer Reading ranges

2010-01-15 Thread ko5tik


On Jan 14, 2:17 am, MPower123 michaelh...@gmail.com wrote:
 Hi,

 I am writing a game for android phone and I want to know what is the
 range of values that can be read from the accelerometer? I want to
 know how many Gs can be read from the accelerometer?
 Or is this dependant on the phone? I've seen an Iphone app that can
 read up to 2.5g, is this possible on android phones?

You can read model of a chip through sensor manager -  usually its
crappy
Bosh Sensortec BM 150  ( sells for about $ 1.5 a kilo) - datasheets
are available on internet.
Usually it set to 8G range, and delivers 256 distinct values, its
also pretty noizy - so not
await gtreat precision from this.
-- 
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: Accelerometer Reading ranges

2010-01-15 Thread MPower123
Can anyone comment on the accelerometer's accuracy?
I've read on other threads that, in general, it is very in accurate
but has anyone tried to write a
signal conditioner to smooth out the signal?

On Jan 14, 4:35 pm, Chris McClanahan mcclanahooc...@gmail.com wrote:
 I believe the max accelerometer reading is 40, thus making it
 sensitive to about (40/9.81)=4.077472G.

 On Jan 13, 3:17 pm, MPower123 michaelh...@gmail.com wrote: Hi,

  I am writing a game for android phone and I want to know what is the
  range of values that can be read from the accelerometer? I want to
  know how many Gs can be read from the accelerometer?
  Or is this dependant on the phone? I've seen an Iphone app that can
  read up to 2.5g, is this possible on android phones?

  Thanks,
-- 
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: Accelerometer Reading ranges

2010-01-15 Thread Chris McClanahan
yes, ko5tik brings up a good point: each android phone may have a
different model accelerometer.

the info i posted earlier was specific to the Droid phone, which has
this sensor: 
http://www.st.com/stonline/products/literature/ds/15094/lis331dlh.pdf

there is an api call to get the max value reading from the
accelerometer sensor; you can use that along with the
onAccuracyChanged callback to create  a filter.


On Jan 15, 9:35 am, MPower123 michaelh...@gmail.com wrote:
 Can anyone comment on the accelerometer's accuracy?
 I've read on other threads that, in general, it is very in accurate
 but has anyone tried to write a
 signal conditioner to smooth out the signal?

 On Jan 14, 4:35 pm, Chris McClanahan mcclanahooc...@gmail.com wrote:



  I believe the max accelerometer reading is 40, thus making it
  sensitive to about (40/9.81)=4.077472G.

  On Jan 13, 3:17 pm, MPower123 michaelh...@gmail.com wrote: Hi,

   I am writing a game for android phone and I want to know what is the
   range of values that can be read from the accelerometer? I want to
   know how many Gs can be read from the accelerometer?
   Or is this dependant on the phone? I've seen an Iphone app that can
   read up to 2.5g, is this possible on android phones?

   Thanks,
-- 
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: Accelerometer Reading ranges

2010-01-14 Thread Chris McClanahan

I believe the max accelerometer reading is 40, thus making it
sensitive to about (40/9.81)=4.077472G.


On Jan 13, 3:17 pm, MPower123 michaelh...@gmail.com wrote:
 Hi,

 I am writing a game for android phone and I want to know what is the
 range of values that can be read from the accelerometer? I want to
 know how many Gs can be read from the accelerometer?
 Or is this dependant on the phone? I've seen an Iphone app that can
 read up to 2.5g, is this possible on android phones?

 Thanks,
-- 
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: Accelerometer OnSensorChanged() no longer occur in standby

2009-08-30 Thread Alexander Kosenkov

I have exactly the same problem with Hero! My app works fine on G1 but
does not receive accelerometer events on Hero in standby with partial
lock.

What could we do? Have you posted bugreport to Android?
--~--~-~--~~~---~--~~
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: Accelerometer OnSensorChanged() no longer occur in standby

2009-08-30 Thread Alexander Kosenkov

I have posted bugreport to Android:

http://code.google.com/p/android/issues/detail?id=3717

Please vote up or add comments if you face with this problem.
--~--~-~--~~~---~--~~
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: Accelerometer OnSensorChanged() no longer occur in standby

2009-08-30 Thread polymorph

Yes, I already have a bug report in for this:

http://code.google.com/p/android/issues/detail?id=3708



On Aug 30, 8:11 am, Alexander Kosenkov alexan...@kosenkov.com wrote:
 I have posted bugreport to Android:

 http://code.google.com/p/android/issues/detail?id=3717

 Please vote up or add comments if you face with this problem.
--~--~-~--~~~---~--~~
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: Accelerometer OnSensorChanged() no longer occur in standby

2009-08-30 Thread Yuri Dario

Hi,


 http://code.google.com/p/android/issues/detail?id=3708

this means my application in the Market is broken too. At least I need
to update the description... this is really bad.

Yuri

--~--~-~--~~~---~--~~
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: Accelerometer OnSensorChanged() no longer occur in standby

2009-08-30 Thread Yuri Dario



 http://code.google.com/p/android/issues/detail?id=3708

 this means my application in the Market is broken too. At least I need
 to update the description... this is really bad.


and worse, ADC2 is about to reach deadline.

--~--~-~--~~~---~--~~
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: Accelerometer OnSensorChanged() no longer occur in standby

2009-08-30 Thread polymorph

Yes, I hope they manage to get this fix rolled in very soon!

I don't have a Magic anymore, but I had a Developer friend try a
Partial wakelock on his, and it did work, so that does seem to be a
temporary workaround on that.  However it doesn't solve it for the
Hero, and I don't know if the Samsung Galaxy and other new phones are
going to have an issue yet either.

The Wakelock has to be a really temporary solution though, as it will
not be good for battery consumption!



On Aug 30, 1:50 pm, Yuri Dario mc6...@mclink.it wrote:
  http://code.google.com/p/android/issues/detail?id=3708

  this means my application in the Market is broken too. At least I need
  to update the description... this is really bad.

 and worse, ADC2 is about to reach deadline.
--~--~-~--~~~---~--~~
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: Accelerometer OnSensorChanged() no longer occur in standby

2009-08-30 Thread Mark Murphy

polymorph wrote:
 Yes, I hope they manage to get this fix rolled in very soon!
 
 I don't have a Magic anymore, but I had a Developer friend try a
 Partial wakelock on his, and it did work, so that does seem to be a
 temporary workaround on that.  However it doesn't solve it for the
 Hero, and I don't know if the Samsung Galaxy and other new phones are
 going to have an issue yet either.

Where in the documentation does it say that sensor readings will wake up
the device to call your code?

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

Android 1.5 Programming Books: http://commonsware.com/books.html

--~--~-~--~~~---~--~~
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: Accelerometer OnSensorChanged() no longer occur in standby

2009-08-30 Thread polymorph

 Where in the documentation does it say that sensor readings will wake up
 the device to call your code?

Hi Mark,
It's in a background service which does get called for GPS location
changes and other things while in standby, so I'd expect it to do so
for the sensor changes too (as it did used to in standby).

--~--~-~--~~~---~--~~
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: Accelerometer OnSensorChanged() no longer occur in standby

2009-08-30 Thread Mark Murphy

polymorph wrote:
 It's in a background service which does get called for GPS location
 changes and other things while in standby, so I'd expect it to do so
 for the sensor changes too (as it did used to in standby).

The subtle point I was trying to get across is that a regression in an
undocumented capability may or may not be a bug, and therefore may or
may not be fixed. The core Android team has been very explicit about
the risks inherent in relying upon undocumented capabilities, even if
this undocumented capability was not addressed specifically. For
example, this issue could very well be dictated by hardware concerns.

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

Android 1.5 Programming Books: http://commonsware.com/books.html

--~--~-~--~~~---~--~~
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: Accelerometer OnSensorChanged() no longer occur in standby

2009-08-30 Thread polymorph

Ok, thanks for the reply Mark.

It seems the documentation doesn't state either way whether anything
will or will not continue to function while in standby.  I wonder if
there's anyone from the Android team that could let me know the
official stance on this?

There's also the situation with the Hero, which won't continue with
these OnSensorChanged() messages even when a WakeLock is in place.



On Aug 30, 5:44 pm, Mark Murphy mmur...@commonsware.com wrote:
 polymorph wrote:
  It's in a background service which does get called for GPS location
  changes and other things while in standby, so I'd expect it to do so
  for the sensor changes too (as it did used to in standby).

 The subtle point I was trying to get across is that a regression in an
 undocumented capability may or may not be a bug, and therefore may or
 may not be fixed. The core Android team has been very explicit about
 the risks inherent in relying upon undocumented capabilities, even if
 this undocumented capability was not addressed specifically. For
 example, this issue could very well be dictated by hardware concerns.

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

 Android 1.5 Programming Books:http://commonsware.com/books.html
--~--~-~--~~~---~--~~
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: Accelerometer OnSensorChanged() no longer occur in standby

2009-08-30 Thread Dianne Hackborn
You need to hold a partial wake lock if you want to ensure that the CPU
continues to run while the screen is off.  There are very, very few
exceptions to this -- broadcasts received from the alarm manager being the
big one.  There may be a few other broadcasts that hold a wake lock for you
while they are being sent, but in almost all cases outside of broadcasts you
will need to hold a wake lock.

Also, keep in mind, sitting there monitoring the sensors while the screen is
off is probably going to be a pretty big battery drain; at the very least,
you'd want to have a very clear UI with the user about what is going on and
how they can turn it off.

On Sun, Aug 30, 2009 at 10:01 AM, polymorph
jaggersoftw...@googlemail.comwrote:


 Ok, thanks for the reply Mark.

 It seems the documentation doesn't state either way whether anything
 will or will not continue to function while in standby.  I wonder if
 there's anyone from the Android team that could let me know the
 official stance on this?

 There's also the situation with the Hero, which won't continue with
 these OnSensorChanged() messages even when a WakeLock is in place.



 On Aug 30, 5:44 pm, Mark Murphy mmur...@commonsware.com wrote:
  polymorph wrote:
   It's in a background service which does get called for GPS location
   changes and other things while in standby, so I'd expect it to do so
   for the sensor changes too (as it did used to in standby).
 
  The subtle point I was trying to get across is that a regression in an
  undocumented capability may or may not be a bug, and therefore may or
  may not be fixed. The core Android team has been very explicit about
  the risks inherent in relying upon undocumented capabilities, even if
  this undocumented capability was not addressed specifically. For
  example, this issue could very well be dictated by hardware concerns.
 
  --
  Mark Murphy (a Commons Guy)http://commonsware.com|
 http://twitter.com/commonsguy
 
  Android 1.5 Programming Books:http://commonsware.com/books.html
 



-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

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@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: Accelerometer OnSensorChanged() no longer occur in standby

2009-08-29 Thread Yuri Dario

Hi,


 I have tried a wakelock, but only the full, screen-on wakelock allows
 it to work, which is undesirable behaviour.

my background service gets accelerometer events with a partial wake
lock (and screen off). ADP1 with latest 1.5 firmware drop by HTC.

bye,

Yuri

--~--~-~--~~~---~--~~
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: Accelerometer OnSensorChanged() no longer occur in standby

2009-08-29 Thread polymorph

Thanks for the reply, but this didn't seem to work for me on either
the Magic or Hero when I tried partial wake locks (you mentioned
trying on ADP1, ie a G1 - have you tried it on any other handsets?)



It has worked in the past without any requirement on a wake lock as
well, so I believe something must have changed recently to cause this.


On Aug 29, 11:04 am, Yuri Dario mc6...@mclink.it wrote:
 Hi,

  I have tried a wakelock, but only the full, screen-on wakelock allows
  it to work, which is undesirable behaviour.

 my background service gets accelerometer events with a partial wake
 lock (and screen off). ADP1 with latest 1.5 firmware drop by HTC.

 bye,

 Yuri
--~--~-~--~~~---~--~~
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: Accelerometer OnSensorChanged() no longer occur in standby

2009-08-29 Thread Yuri Dario

Hi,


 the Magic or Hero when I tried partial wake locks (you mentioned
 trying on ADP1, ie a G1 - have you tried it on any other handsets?)

there are over 100 users now, so I think it works; I'll ask someone I
know has a magic.

 It has worked in the past without any requirement on a wake lock as
 well, so I believe something must have changed recently to cause this.

I saw that 1.0/1.1 was not sending sensor updates at all when screen
was off, this has been changed in 1.5

bye,

Yuri

--~--~-~--~~~---~--~~
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: Accelerometer Speaker Interference Workarounds?

2009-08-28 Thread Chris Stratton

On Aug 28, 7:39 pm, Robert Green rbgrn@gmail.com wrote:

 It's no secret that both the HTC Dream and HTC Magic have problems
 with sound from the built-in speaker interfering with the
 accelerometer.  I'm currently having the problem with my new game and
 am not sure how I'm supposed to work around it.  Quite frankly, the
 sound is a big part of the game and most people prefer to play with it
 on.  I found a great way to use tilt-view control and it works really
 well until I turn sound on, then it all goes to crap.

 Sure, I could crank the sample rate up to highest and take a running
 average of the past 5 or so samples and pull out the outliers but it's
 still not very accurate.

Ugh, if your observation is accurate this sounds like a system design
bug.   Average actually won't fully work, because the sensor needs to
be low pass filtered before the analog to digital conversion, in order
to keep any frequency components above its nyquist limit out of the
digitizer.   Otherwise you will get really odd effects if you have an
audio frequency that's near a multiple of the sample rate... they can
alias back to near zero frequency and look like very slow variations
in reading, which would go right through your averaging.
--~--~-~--~~~---~--~~
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: Accelerometer Speaker Interference Workarounds?

2009-08-28 Thread Robert Green

And that's almost exactly what I see.  I notice extra bad numbers
coming through on certain frequencies of sound.  I know I've
complained about one or two things in the past but this really is a
pretty bad flaw.  Let's hope future devices don't have the same
problems.

On Aug 28, 7:56 pm, Chris Stratton cs07...@gmail.com wrote:
 On Aug 28, 7:39 pm, Robert Green rbgrn@gmail.com wrote:

  It's no secret that both the HTC Dream and HTC Magic have problems
  with sound from the built-in speaker interfering with the
  accelerometer.  I'm currently having the problem with my new game and
  am not sure how I'm supposed to work around it.  Quite frankly, the
  sound is a big part of the game and most people prefer to play with it
  on.  I found a great way to use tilt-view control and it works really
  well until I turn sound on, then it all goes to crap.

  Sure, I could crank the sample rate up to highest and take a running
  average of the past 5 or so samples and pull out the outliers but it's
  still not very accurate.

 Ugh, if your observation is accurate this sounds like a system design
 bug.   Average actually won't fully work, because the sensor needs to
 be low pass filtered before the analog to digital conversion, in order
 to keep any frequency components above its nyquist limit out of the
 digitizer.   Otherwise you will get really odd effects if you have an
 audio frequency that's near a multiple of the sample rate... they can
 alias back to near zero frequency and look like very slow variations
 in reading, which would go right through your averaging.
--~--~-~--~~~---~--~~
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: Accelerometer Speaker Interference Workarounds?

2009-08-28 Thread Chris Stratton

it might be interesting to slowly sweep a sine wave across the audio
range while plotting variation in the accelerometer reading...

On Aug 28, 9:40 pm, Robert Green rbgrn@gmail.com wrote:
 And that's almost exactly what I see.  I notice extra bad numbers
 coming through on certain frequencies of sound.  I know I've
 complained about one or two things in the past but this really is a
 pretty bad flaw.  Let's hope future devices don't have the same
 problems.

 On Aug 28, 7:56 pm, Chris Stratton cs07...@gmail.com wrote:



  On Aug 28, 7:39 pm, Robert Green rbgrn@gmail.com wrote:

   It's no secret that both the HTC Dream and HTC Magic have problems
   with sound from the built-in speaker interfering with the
   accelerometer.  I'm currently having the problem with my new game and
   am not sure how I'm supposed to work around it.  Quite frankly, the
   sound is a big part of the game and most people prefer to play with it
   on.  I found a great way to use tilt-view control and it works really
   well until I turn sound on, then it all goes to crap.

   Sure, I could crank the sample rate up to highest and take a running
   average of the past 5 or so samples and pull out the outliers but it's
   still not very accurate.

  Ugh, if your observation is accurate this sounds like a system design
  bug.   Average actually won't fully work, because the sensor needs to
  be low pass filtered before the analog to digital conversion, in order
  to keep any frequency components above its nyquist limit out of the
  digitizer.   Otherwise you will get really odd effects if you have an
  audio frequency that's near a multiple of the sample rate... they can
  alias back to near zero frequency and look like very slow variations
  in reading, which would go right through your averaging.
--~--~-~--~~~---~--~~
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: Accelerometer shake side-to-side detection issue

2009-08-02 Thread doubleslash

The shaking corresponds to a big jump in the 2nd derivative of the
acceleration along the direction of interest. I don't know if
onSensorChanged is called frequently enough to let you detect that
blip though.

On Jul 31, 12:44 pm, Alex Corbi a.co...@gmail.com wrote:
 Hi everybody,

 I'm developing an app and i need to detect when the user shakes the
 phone from side to side , that means just along one axis (in this case
 X) . That for i'm reading the values from the accelerometer, a bit of
 code:

 private final double THRESHOLD = 0.2;

 @Override
         public void onSensorChanged(SensorEvent event) {
                         if (series!=null){
                                 if (event.values[0]  -THRESHOLD){
                                         moving = LEFT;
                                 }else if (event.values[0]  THRESHOLD){
                                         moving = RIGHT;
                             }
                         }
         }

 I want to know when the user shakes the phone to the left and when to
 the right, the problem is that my code does not detect shaking but
 tilt, i have tested this code and it works when i tilt the phone to
 left or to the right, but not when a shake it from side to side (no
 matter the orientation of the phone).

 ¿do you guys know what i'm doing wrong? ¿how would you code it? i'm
 testing it on a Samsung galaxy.

 - i dont what to detect an arbitrary shake , i want to detect the
 acceleration along the x axis, something in this direction:(from the
 documentation)

 When the device lies flat on a table and is pushed on its left side
 toward the right, the x acceleration value is positive.

 Thanks in advance.
--~--~-~--~~~---~--~~
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: Accelerometer data

2009-06-30 Thread jdesbonnet

I had a good laugh at this one. I could be wrong, but often when
complex arithmetic code involving physical units fail and the code
originates from the US it usually means one thing.. hint: Mars Climate
Orbiter disaster (http://en.wikipedia.org/wiki/Mars_Climate_Orbiter).

The figure you mention (30) is consistent with g in Ye Olde Imperial
Units of feet per micro-fortnight squared :-)

J.


On Jun 29, 2:58 pm, House n @ MIT to...@mit.edu wrote:
 Hello,
 I've been doing some testing on the accelerometer, specifically with
 the old SensorListener and new SensorEventListener versions available
 as of Cupcake.

 Using SensorListener, I've been getting normal acceleration values as
 expected according to the documentation - around 9.8 on the axis in
 line with gravity when sitting still. When I upgraded the code to
 SensorEventListener, that number jumped to around 30, which is not
 consistent with the documentation. I've tried sampling at different
 rates, but generally I've been using game mode, since that's the rate
 I ultimately intend to use.

 I'd be interested to hear if anyone has seen this behavior, has any
 ideas about it, or sees an issue with the code below. Give it a test
 run yourself. It might be relevant to note that the
 SensorEvent.accuracy is SENSOR_STATUS_ACCURACY_HIGH.

 When I run this code with the phone sitting flat on a table, screen,
 up, I get values like these:

 x: 12.5625      y: 20.8125      z: -16.4375

 

 package edu.accel;

 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.PrintWriter;
 import java.util.List;

 import android.app.Activity;
 import android.content.Context;
 import android.hardware.Sensor;
 import android.hardware.SensorEvent;
 import android.hardware.SensorEventListener;
 import android.hardware.SensorManager;
 import android.os.Bundle;

 public class AccelTest extends Activity {

         private SensorManager mSensorManager;

     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.main);

                 // Set up the accelerometer reading
       mSensorManager = (SensorManager)getSystemService
 (Context.SENSOR_SERVICE);
       // Get the list of all sensors, and find the accelerometer
 within
       ListSensor sensorList = mSensorManager.getSensorList
 (SensorManager.SENSOR_ACCELEROMETER);

       mSensorManager.registerListener(mSensorListener,
                   sensorList.get(0),
                   SensorManager.SENSOR_DELAY_UI);

     }

         //Accelerometer
   private final SensorEventListener mSensorListener = new
 SensorEventListener() {

         private PrintWriter mCurrentFile;

         boolean never = true;
         String comma = new String(,);

         public void runOnce()
         {
                 //Creating a file to print the data into

         String nameStr = new String(/sdcard/10 second trials.xls);
                 File outputFile = new File(nameStr);
                 mCurrentFile = null;
                 try {
                         mCurrentFile = new PrintWriter(new 
 FileOutputStream(outputFile));
                 } catch (FileNotFoundException e) {
                         // TODO Auto-generated catch block
                         e.printStackTrace();
                 }

         }

                 @Override
                 public void onAccuracyChanged(Sensor sensor, int accuracy) {
                         // TODO Auto-generated method stub

                 }

                 @Override
                 public void onSensorChanged(SensorEvent event) {

                         if (never)
                 {
                         never = false;
                         runOnce();
                 }
                         StringBuffer buff = new StringBuffer();
                         buff.append(String.valueOf(event.values[0]));
                         buff.append(comma);
                         buff.append(String.valueOf(event.values[1]));
                         buff.append(comma);
                         buff.append(String.valueOf(event.values[2]));
                         mCurrentFile.println(buff.toString());
                 }
   };

 }


--~--~-~--~~~---~--~~
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: Accelerometer data

2009-06-30 Thread Peli


 x: 12.5625  y: 20.8125  z: -16.4375

Unfortunately, I didn't have a chance yet to try out sensors through
the SDK 1.5 API on a real device yet, but these numbers look like they
could be from a compass (in microTesla).

Did you try rotating the device around its axis, while lying flat on
the table? Do the x and y values change? If they do, then you have
compass data (because accelerometer is not sensitive to that
rotation). If you don't then you have really weird accelerometer
data...

Peli
www.openintents.org

On Jun 29, 3:58 pm, House n @ MIT to...@mit.edu wrote:
 Hello,
 I've been doing some testing on the accelerometer, specifically with
 the old SensorListener and new SensorEventListener versions available
 as of Cupcake.

 Using SensorListener, I've been getting normal acceleration values as
 expected according to the documentation - around 9.8 on the axis in
 line with gravity when sitting still. When I upgraded the code to
 SensorEventListener, that number jumped to around 30, which is not
 consistent with the documentation. I've tried sampling at different
 rates, but generally I've been using game mode, since that's the rate
 I ultimately intend to use.

 I'd be interested to hear if anyone has seen this behavior, has any
 ideas about it, or sees an issue with the code below. Give it a test
 run yourself. It might be relevant to note that the
 SensorEvent.accuracy is SENSOR_STATUS_ACCURACY_HIGH.

 When I run this code with the phone sitting flat on a table, screen,
 up, I get values like these:

 x: 12.5625      y: 20.8125      z: -16.4375

 

 package edu.accel;

 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.PrintWriter;
 import java.util.List;

 import android.app.Activity;
 import android.content.Context;
 import android.hardware.Sensor;
 import android.hardware.SensorEvent;
 import android.hardware.SensorEventListener;
 import android.hardware.SensorManager;
 import android.os.Bundle;

 public class AccelTest extends Activity {

         private SensorManager mSensorManager;

     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.main);

                 // Set up the accelerometer reading
       mSensorManager = (SensorManager)getSystemService
 (Context.SENSOR_SERVICE);
       // Get the list of all sensors, and find the accelerometer
 within
       ListSensor sensorList = mSensorManager.getSensorList
 (SensorManager.SENSOR_ACCELEROMETER);

       mSensorManager.registerListener(mSensorListener,
                   sensorList.get(0),
                   SensorManager.SENSOR_DELAY_UI);

     }

         //Accelerometer
   private final SensorEventListener mSensorListener = new
 SensorEventListener() {

         private PrintWriter mCurrentFile;

         boolean never = true;
         String comma = new String(,);

         public void runOnce()
         {
                 //Creating a file to print the data into

         String nameStr = new String(/sdcard/10 second trials.xls);
                 File outputFile = new File(nameStr);
                 mCurrentFile = null;
                 try {
                         mCurrentFile = new PrintWriter(new 
 FileOutputStream(outputFile));
                 } catch (FileNotFoundException e) {
                         // TODO Auto-generated catch block
                         e.printStackTrace();
                 }

         }

                 @Override
                 public void onAccuracyChanged(Sensor sensor, int accuracy) {
                         // TODO Auto-generated method stub

                 }

                 @Override
                 public void onSensorChanged(SensorEvent event) {

                         if (never)
                 {
                         never = false;
                         runOnce();
                 }
                         StringBuffer buff = new StringBuffer();
                         buff.append(String.valueOf(event.values[0]));
                         buff.append(comma);
                         buff.append(String.valueOf(event.values[1]));
                         buff.append(comma);
                         buff.append(String.valueOf(event.values[2]));
                         mCurrentFile.println(buff.toString());
                 }
   };

 }
--~--~-~--~~~---~--~~
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: Accelerometer data

2009-06-30 Thread jdesbonnet

I checked with my Vodafone branded HTC Magic (using Android 1.5 API).
Using SensorEventListener and the following code to register the
listener:

Sensor accSensor = mSensorManager.getSensorList
(Sensor.TYPE_ACCELEROMETER).get(0);
mSensorManager.registerListener(accSensorListener, accSensor,
SENSOR_DELAY);

I tried values for SENSOR_DELAY: SensorManager.SENSOR_DELAY_FASTEST,
SensorManager.SENSOR_DELAY_GAME and
SensorManager.SENSOR_DELAY_NORMAL...  all give me g vectors with
magnitude ~ 9.8.

Joe.

On Jun 30, 2:17 pm, Peli peli0...@googlemail.com wrote:
  x: 12.5625      y: 20.8125      z: -16.4375

 Unfortunately, I didn't have a chance yet to try out sensors through
 the SDK 1.5 API on a real device yet, but these numbers look like they
 could be from a compass (in microTesla).

 Did you try rotating the device around its axis, while lying flat on
 the table? Do the x and y values change? If they do, then you have
 compass data (because accelerometer is not sensitive to that
 rotation). If you don't then you have really weird accelerometer
 data...

 Peliwww.openintents.org

 On Jun 29, 3:58 pm, House n @ MIT to...@mit.edu wrote:

  Hello,
  I've been doing some testing on the accelerometer, specifically with
  the old SensorListener and new SensorEventListener versions available
  as of Cupcake.

  Using SensorListener, I've been getting normal acceleration values as
  expected according to the documentation - around 9.8 on the axis in
  line with gravity when sitting still. When I upgraded the code to
  SensorEventListener, that number jumped to around 30, which is not
  consistent with the documentation. I've tried sampling at different
  rates, but generally I've been using game mode, since that's the rate
  I ultimately intend to use.

  I'd be interested to hear if anyone has seen this behavior, has any
  ideas about it, or sees an issue with the code below. Give it a test
  run yourself. It might be relevant to note that the
  SensorEvent.accuracy is SENSOR_STATUS_ACCURACY_HIGH.

  When I run this code with the phone sitting flat on a table, screen,
  up, I get values like these:

  x: 12.5625      y: 20.8125      z: -16.4375

  

  package edu.accel;

  import java.io.File;
  import java.io.FileNotFoundException;
  import java.io.FileOutputStream;
  import java.io.PrintWriter;
  import java.util.List;

  import android.app.Activity;
  import android.content.Context;
  import android.hardware.Sensor;
  import android.hardware.SensorEvent;
  import android.hardware.SensorEventListener;
  import android.hardware.SensorManager;
  import android.os.Bundle;

  public class AccelTest extends Activity {

          private SensorManager mSensorManager;

      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);

                  // Set up the accelerometer reading
        mSensorManager = (SensorManager)getSystemService
  (Context.SENSOR_SERVICE);
        // Get the list of all sensors, and find the accelerometer
  within
        ListSensor sensorList = mSensorManager.getSensorList
  (SensorManager.SENSOR_ACCELEROMETER);

        mSensorManager.registerListener(mSensorListener,
                    sensorList.get(0),
                    SensorManager.SENSOR_DELAY_UI);

      }

          //Accelerometer
    private final SensorEventListener mSensorListener = new
  SensorEventListener() {

          private PrintWriter mCurrentFile;

          boolean never = true;
          String comma = new String(,);

          public void runOnce()
          {
                  //Creating a file to print the data into

          String nameStr = new String(/sdcard/10 second trials.xls);
                  File outputFile = new File(nameStr);
                  mCurrentFile = null;
                  try {
                          mCurrentFile = new PrintWriter(new 
  FileOutputStream(outputFile));
                  } catch (FileNotFoundException e) {
                          // TODO Auto-generated catch block
                          e.printStackTrace();
                  }

          }

                  @Override
                  public void onAccuracyChanged(Sensor sensor, int accuracy) {
                          // TODO Auto-generated method stub

                  }

                  @Override
                  public void onSensorChanged(SensorEvent event) {

                          if (never)
                  {
                          never = false;
                          runOnce();
                  }
                          StringBuffer buff = new StringBuffer();
                          buff.append(String.valueOf(event.values[0]));
                          buff.append(comma);
                          buff.append(String.valueOf(event.values[1]));
                          buff.append(comma);
                          

[android-developers] Re: Accelerometer data

2009-06-30 Thread Peli

Then the solution is quite simple:

House n @ MIT used the deprecated constant
(@deprecated) SensorManager.SENSOR_ACCELEROMETER = (const) 2
with the new API, while jdesbonnet used
Sensor.TYPE_ACCELEROMETER = (const) 1

The constant value used above (=2) corresponds to
Sensor.TYPE_MAGNETIC_FIELD = (const) 2 in the new API, so indeed House
n @ MIT saw compass data, as I suspected.

Case solved :-)

Peli
www.openintents.org

On Jun 30, 4:15 pm, jdesbonnet jdesbon...@gmail.com wrote:
 I checked with my Vodafone branded HTC Magic (using Android 1.5 API).
 Using SensorEventListener and the following code to register the
 listener:

 Sensor accSensor = mSensorManager.getSensorList
 (Sensor.TYPE_ACCELEROMETER).get(0);
 mSensorManager.registerListener(accSensorListener, accSensor,
 SENSOR_DELAY);

 I tried values for SENSOR_DELAY: SensorManager.SENSOR_DELAY_FASTEST,
 SensorManager.SENSOR_DELAY_GAME and
 SensorManager.SENSOR_DELAY_NORMAL...  all give me g vectors with
 magnitude ~ 9.8.

 Joe.

 On Jun 30, 2:17 pm, Peli peli0...@googlemail.com wrote:

   x: 12.5625      y: 20.8125      z: -16.4375

  Unfortunately, I didn't have a chance yet to try out sensors through
  the SDK 1.5 API on a real device yet, but these numbers look like they
  could be from a compass (in microTesla).

  Did you try rotating the device around its axis, while lying flat on
  the table? Do the x and y values change? If they do, then you have
  compass data (because accelerometer is not sensitive to that
  rotation). If you don't then you have really weird accelerometer
  data...

  Peliwww.openintents.org

  On Jun 29, 3:58 pm, House n @ MIT to...@mit.edu wrote:

   Hello,
   I've been doing some testing on the accelerometer, specifically with
   the old SensorListener and new SensorEventListener versions available
   as of Cupcake.

   Using SensorListener, I've been getting normal acceleration values as
   expected according to the documentation - around 9.8 on the axis in
   line with gravity when sitting still. When I upgraded the code to
   SensorEventListener, that number jumped to around 30, which is not
   consistent with the documentation. I've tried sampling at different
   rates, but generally I've been using game mode, since that's the rate
   I ultimately intend to use.

   I'd be interested to hear if anyone has seen this behavior, has any
   ideas about it, or sees an issue with the code below. Give it a test
   run yourself. It might be relevant to note that the
   SensorEvent.accuracy is SENSOR_STATUS_ACCURACY_HIGH.

   When I run this code with the phone sitting flat on a table, screen,
   up, I get values like these:

   x: 12.5625      y: 20.8125      z: -16.4375

   

   package edu.accel;

   import java.io.File;
   import java.io.FileNotFoundException;
   import java.io.FileOutputStream;
   import java.io.PrintWriter;
   import java.util.List;

   import android.app.Activity;
   import android.content.Context;
   import android.hardware.Sensor;
   import android.hardware.SensorEvent;
   import android.hardware.SensorEventListener;
   import android.hardware.SensorManager;
   import android.os.Bundle;

   public class AccelTest extends Activity {

           private SensorManager mSensorManager;

       @Override
       public void onCreate(Bundle savedInstanceState) {
           super.onCreate(savedInstanceState);
           setContentView(R.layout.main);

                   // Set up the accelerometer reading
         mSensorManager = (SensorManager)getSystemService
   (Context.SENSOR_SERVICE);
         // Get the list of all sensors, and find the accelerometer
   within
         ListSensor sensorList = mSensorManager.getSensorList
   (SensorManager.SENSOR_ACCELEROMETER);

         mSensorManager.registerListener(mSensorListener,
                     sensorList.get(0),
                     SensorManager.SENSOR_DELAY_UI);

       }

           //Accelerometer
     private final SensorEventListener mSensorListener = new
   SensorEventListener() {

           private PrintWriter mCurrentFile;

           boolean never = true;
           String comma = new String(,);

           public void runOnce()
           {
                   //Creating a file to print the data into

           String nameStr = new String(/sdcard/10 second trials.xls);
                   File outputFile = new File(nameStr);
                   mCurrentFile = null;
                   try {
                           mCurrentFile = new PrintWriter(new 
   FileOutputStream(outputFile));
                   } catch (FileNotFoundException e) {
                           // TODO Auto-generated catch block
                           e.printStackTrace();
                   }

           }

                   @Override
                   public void onAccuracyChanged(Sensor sensor, int 
   accuracy) {
                           // TODO Auto-generated method stub

                   }

    

[android-developers] Re: Accelerometer data

2009-06-30 Thread House n @ MIT

Thanks for the help.  You were right, Peli, I was using the old
constant for the new interface.  I made that small change, and
everything is looking the way it should now.  Thanks again!

On Jun 30, 10:53 am, Peli peli0...@googlemail.com wrote:
 Then the solution is quite simple:

 Housen@ MIT used the deprecated constant
 (@deprecated) SensorManager.SENSOR_ACCELEROMETER = (const) 2
 with the new API, while jdesbonnet used
 Sensor.TYPE_ACCELEROMETER = (const) 1

 The constant value used above (=2) corresponds to
 Sensor.TYPE_MAGNETIC_FIELD = (const) 2 in the new API, so indeedHousen@ MIT 
 saw compass data, as I suspected.

 Case solved :-)

 Peliwww.openintents.org

 On Jun 30, 4:15 pm, jdesbonnet jdesbon...@gmail.com wrote:



  I checked with my Vodafone branded HTC Magic (using Android 1.5 API).
  Using SensorEventListener and the following code to register the
  listener:

  Sensor accSensor = mSensorManager.getSensorList
  (Sensor.TYPE_ACCELEROMETER).get(0);
  mSensorManager.registerListener(accSensorListener, accSensor,
  SENSOR_DELAY);

  I tried values for SENSOR_DELAY: SensorManager.SENSOR_DELAY_FASTEST,
  SensorManager.SENSOR_DELAY_GAME and
  SensorManager.SENSOR_DELAY_NORMAL...  all give me g vectors with
  magnitude ~ 9.8.

  Joe.

  On Jun 30, 2:17 pm, Peli peli0...@googlemail.com wrote:

x: 12.5625      y: 20.8125      z: -16.4375

   Unfortunately, I didn't have a chance yet to try out sensors through
   the SDK 1.5 API on a real device yet, but these numbers look like they
   could be from a compass (in microTesla).

   Did you try rotating the device around its axis, while lying flat on
   the table? Do the x and y values change? If they do, then you have
   compass data (because accelerometer is not sensitive to that
   rotation). If you don't then you have really weird accelerometer
   data...

   Peliwww.openintents.org

   On Jun 29, 3:58 pm, Housen@ MIT to...@mit.edu wrote:

Hello,
I've been doing some testing on the accelerometer, specifically with
the old SensorListener and new SensorEventListener versions available
as of Cupcake.

Using SensorListener, I've been getting normal acceleration values as
expected according to the documentation - around 9.8 on the axis in
line with gravity when sitting still. When I upgraded the code to
SensorEventListener, that number jumped to around 30, which is not
consistent with the documentation. I've tried sampling at different
rates, but generally I've been using game mode, since that's the rate
I ultimately intend to use.

I'd be interested to hear if anyone has seen this behavior, has any
ideas about it, or sees an issue with the code below. Give it a test
run yourself. It might be relevant to note that the
SensorEvent.accuracy is SENSOR_STATUS_ACCURACY_HIGH.

When I run this code with the phone sitting flat on a table, screen,
up, I get values like these:

x: 12.5625      y: 20.8125      z: -16.4375



package edu.accel;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.util.List;

import android.app.Activity;
import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Bundle;

public class AccelTest extends Activity {

        private SensorManager mSensorManager;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

                // Set up the accelerometer reading
      mSensorManager = (SensorManager)getSystemService
(Context.SENSOR_SERVICE);
      // Get the list of all sensors, and find the accelerometer
within
      ListSensor sensorList = mSensorManager.getSensorList
(SensorManager.SENSOR_ACCELEROMETER);

      mSensorManager.registerListener(mSensorListener,
                  sensorList.get(0),
                  SensorManager.SENSOR_DELAY_UI);

    }

        //Accelerometer
  private final SensorEventListener mSensorListener = new
SensorEventListener() {

        private PrintWriter mCurrentFile;

        boolean never = true;
        String comma = new String(,);

        public void runOnce()
        {
                //Creating a file to print the data into

        String nameStr = new String(/sdcard/10 second trials.xls);
                File outputFile = new File(nameStr);
                mCurrentFile = null;
                try {
                        mCurrentFile = new PrintWriter(new 
FileOutputStream(outputFile));
                } catch (FileNotFoundException e) {
   

[android-developers] Re: Accelerometer

2009-06-25 Thread Delta Foxtrot
2009/6/26 kalyan simhan kalyansim...@gmail.com

 there seems to be some problem with my accelerometer...
 the values of x,y,z fluctuate even when it is stationary.. kept
 in one place... why is this.. how can i overcome it..
 what is the unit of the value im getting.. im guessing 1 unit = 1g


9.8m/s^2 is an approximation, however the accelerometer is being influenced
by forces and noise, the only way to over come it would be to sample the
noise and then try to cancel it out.

--~--~-~--~~~---~--~~
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: Accelerometer

2009-06-25 Thread Sundog


 9.8m/s^2 is an approximation, however the accelerometer is being influenced
 by forces and noise, the only way to over come it would be to sample the
 noise and then try to cancel it out.

Or you can simply integrate the result over time.
--~--~-~--~~~---~--~~
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: Accelerometer/Orientation sensor problem

2009-06-11 Thread Sundog

Just a me too to report that this problem is real and is still here
under Cupcake. Play a sound and the accelerometer goes haywire for a
second. Only fix I can see is ignoring the accelerometer while SFX are
playing... kinda not really a good workaround for a game.

On Jun 8, 8:25 am, TjerkW tje...@gmail.com wrote:
 Sameproblemhere,

 when playing sounds during my game (in which you control the gameplay
 withaccelerometer)
 theaccelerometergives strange values.

 On 24 mei, 13:29, Bonifaz bonifaz.kaufm...@gmail.com wrote:



  I have the sameproblemof wiredaccelerometerdata while music is
  playing.

  Does anyone have a workaround for this. Some kind of filter mechanism
  perhaps.

  I use FloatMath.sqrt(x*x + y*y + z*z) for shake detection.
  But even with that formular, playing music always detects shake,
  just raising the threshold won't work, since shake would not be
  detected with to high threshold.- Hide quoted text -

 - Show quoted text -
--~--~-~--~~~---~--~~
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: Accelerometer/Orientation sensor problem

2009-06-11 Thread Sundog

I'd be very interested to know if anyone besides G1 owners has seen
this? My best guess is that it's a design flaw specific to this
phone... and if so, no fix will be forthcoming.

On Jun 11, 2:20 pm, Sundog sunns...@gmail.com wrote:
 Just a me too to report that this problem is real and is still here
 under Cupcake. Play a sound and the accelerometer goes haywire for a
 second. Only fix I can see is ignoring the accelerometer while SFX are
 playing... kinda not really a good workaround for a game.

 On Jun 8, 8:25 am, TjerkW tje...@gmail.com wrote:



  Sameproblemhere,

  when playing sounds during my game (in which you control the gameplay
  withaccelerometer)
  theaccelerometergives strange values.

  On 24 mei, 13:29, Bonifaz bonifaz.kaufm...@gmail.com wrote:

   I have the sameproblemof wiredaccelerometerdata while music is
   playing.

   Does anyone have a workaround for this. Some kind of filter mechanism
   perhaps.

   I use FloatMath.sqrt(x*x + y*y + z*z) for shake detection.
   But even with that formular, playing music always detects shake,
   just raising the threshold won't work, since shake would not be
   detected with to high threshold.- Hide quoted text -

  - Show quoted text -- Hide quoted text -

 - Show quoted text -
--~--~-~--~~~---~--~~
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: Accelerometer/Orientation sensor problem

2009-06-11 Thread TjerkW

Nope this problem is is also on the htc magic .. check my post for a
solution using a damper. Somewhere else in this group ...

On 11 jun, 22:28, Sundog sunns...@gmail.com wrote:
 I'd be very interested to know if anyone besides G1 owners has seen
 this? My best guess is that it's a design flaw specific to this
 phone... and if so, no fix will be forthcoming.

 On Jun 11, 2:20 pm, Sundog sunns...@gmail.com wrote:



  Just a me too to report that this problem is real and is still here
  under Cupcake. Play a sound and the accelerometer goes haywire for a
  second. Only fix I can see is ignoring the accelerometer while SFX are
  playing... kinda not really a good workaround for a game.

  On Jun 8, 8:25 am, TjerkW tje...@gmail.com wrote:

   Sameproblemhere,

   when playing sounds during my game (in which you control the gameplay
   withaccelerometer)
   theaccelerometergives strange values.

   On 24 mei, 13:29, Bonifaz bonifaz.kaufm...@gmail.com wrote:

I have the sameproblemof wiredaccelerometerdata while music is
playing.

Does anyone have a workaround for this. Some kind of filter mechanism
perhaps.

I use FloatMath.sqrt(x*x + y*y + z*z) for shake detection.
But even with that formular, playing music always detects shake,
just raising the threshold won't work, since shake would not be
detected with to high threshold.- Hide quoted text -

   - Show quoted text -- Hide quoted text -

  - Show quoted text -
--~--~-~--~~~---~--~~
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: Accelerometer/Orientation sensor problem

2009-06-11 Thread Sundog

Thanks much!

Actually for my purposes ignoring the sensor for a second will work
just fine, but I will check out your info for the next time around.

I'm kinda designing my new game BASED on the limitations of the
phone... i.e. choosing the complexity of the views based on how much
the poor innumerate G1 can handle before bogging down, that sort of
thing. So this is just more of the same, sigh.

On Jun 11, 2:34 pm, TjerkW tje...@gmail.com wrote:
 Nope this problem is is also on the htc magic .. check my post for a
 solution using a damper. Somewhere else in this group ...

 On 11 jun, 22:28, Sundog sunns...@gmail.com wrote:



  I'd be very interested to know if anyone besides G1 owners has seen
  this? My best guess is that it's a design flaw specific to this
  phone... and if so, no fix will be forthcoming.

  On Jun 11, 2:20 pm, Sundog sunns...@gmail.com wrote:

   Just a me too to report that this problem is real and is still here
   under Cupcake. Play a sound and the accelerometer goes haywire for a
   second. Only fix I can see is ignoring the accelerometer while SFX are
   playing... kinda not really a good workaround for a game.

   On Jun 8, 8:25 am, TjerkW tje...@gmail.com wrote:

Sameproblemhere,

when playing sounds during my game (in which you control the gameplay
withaccelerometer)
theaccelerometergives strange values.

On 24 mei, 13:29, Bonifaz bonifaz.kaufm...@gmail.com wrote:

 I have the sameproblemof wiredaccelerometerdata while music is
 playing.

 Does anyone have a workaround for this. Some kind of filter mechanism
 perhaps.

 I use FloatMath.sqrt(x*x + y*y + z*z) for shake detection.
 But even with that formular, playing music always detects shake,
 just raising the threshold won't work, since shake would not be
 detected with to high threshold.- Hide quoted text -

- Show quoted text -- Hide quoted text -

   - Show quoted text -- Hide quoted text -

 - Show quoted text -
--~--~-~--~~~---~--~~
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: Accelerometer/Orientation sensor problem

2009-06-08 Thread TjerkW

Same problem here,

when playing sounds during my game (in which you control the gameplay
with accelerometer)
the accelerometer gives strange values.

On 24 mei, 13:29, Bonifaz bonifaz.kaufm...@gmail.com wrote:
 I have the same problem of wired accelerometer data while music is
 playing.

 Does anyone have a workaround for this. Some kind of filter mechanism
 perhaps.

 I use FloatMath.sqrt(x*x + y*y + z*z) for shake detection.
 But even with that formular, playing music always detects shake,
 just raising the threshold won't work, since shake would not be
 detected with to high threshold.
--~--~-~--~~~---~--~~
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: Accelerometer readings - Screen coordinates

2009-06-08 Thread Robert Green

Understand that the accelerometer shows force in 3 directions.  When
the phone isn't moving, it will have 9.8m/s2 (gravity) reading on it.
You can use that to figure out exactly where the phone is pointed.
You can get 3 vectors to show the angle of X,Y and Z relative to
gravity if you use arctan(r0,r1) arctan(r1,r2) arctan(r0,r2) where r0,
r1 and r2 are the first 3 values of accelerometer readings.  This is
all the information I can give you because after that, it's all clever
programming to make good use of these numbers and that is application-
specific.

On Jun 8, 5:11 am, sagar.indianic sagar.india...@gmail.com wrote:
 Hello every1,

 I am developing a small application for learning purpose which will
 move image when accelerometer readings change. I want a mapping of
 accelerometer values to screen coordinates. I am using trial and error
 method rite now. But it seems that it will not help. Is there any
 algorithm??

 Please help!!!

 Thanks!!
--~--~-~--~~~---~--~~
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: Accelerometer is cukoo???

2009-05-31 Thread youssef henry
i have the same problem, anyone can help?

On Fri, May 15, 2009 at 5:06 PM, doubleslash doublesl...@gmail.com wrote:


 This problem occurs only when activity is set explicitly to landscape
 in manifest. Anyway to make it work in landscape?
 Thanks

 On May 14, 10:16 pm, doubleslash doublesl...@gmail.com wrote:
  I see an acceleration of -9 in the y-direction ( due to gravity, of
  course). Now, keeping the phone fixed, not rotating the screen or
  anything, I interrupt the app my pressing the call button and then
  coming back, I see an acceleration of +9 in the x-direction. This
  switching of the coordinates happens without onAccuracyChanged being
  called, so how on Earth can we consistently use the accelerometer's
  output?
 
  Please shed some light on this. Is this fixed in SDK 1.5?
 


--~--~-~--~~~---~--~~
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: Accelerometer is cukoo???

2009-05-31 Thread youssef henry
i found a solution of this problem:
in the onSensorChanged function
public void onSensorChanged(int sensor, float[] values) {
/*
that is the normal code with have the problem
float x=values[0];
float y=values[1];
float z=values[2];
which 0,1,2 is the Accelerometer values based on the orientation and this
give an error some time in the landscape orientation
*/
/*
this is the correct code
*/
float tmpX=values[3];
float tmpY=values[4];
float z=values[5];
 /*
where 3,4,5 is the PORTRAIT screen orientation
so if u want to use it in the land scape orientation swap x and y
*/
float x = -1*tmpY;
float y = x;
}


On Sun, May 31, 2009 at 12:57 PM, youssef henry
youssefhenry2...@gmail.comwrote:

 i have the same problem, anyone can help?


 On Fri, May 15, 2009 at 5:06 PM, doubleslash doublesl...@gmail.comwrote:


 This problem occurs only when activity is set explicitly to landscape
 in manifest. Anyway to make it work in landscape?
 Thanks

 On May 14, 10:16 pm, doubleslash doublesl...@gmail.com wrote:
  I see an acceleration of -9 in the y-direction ( due to gravity, of
  course). Now, keeping the phone fixed, not rotating the screen or
  anything, I interrupt the app my pressing the call button and then
  coming back, I see an acceleration of +9 in the x-direction. This
  switching of the coordinates happens without onAccuracyChanged being
  called, so how on Earth can we consistently use the accelerometer's
  output?
 
  Please shed some light on this. Is this fixed in SDK 1.5?
 






--~--~-~--~~~---~--~~
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: Accelerometer/Orientation sensor problem

2009-05-24 Thread Bonifaz

I have the same problem of wired accelerometer data while music is
playing.

Does anyone have a workaround for this. Some kind of filter mechanism
perhaps.

I use FloatMath.sqrt(x*x + y*y + z*z) for shake detection.
But even with that formular, playing music always detects shake,
just raising the threshold won't work, since shake would not be
detected with to high threshold.

--~--~-~--~~~---~--~~
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: Accelerometer is cukoo???

2009-05-15 Thread doubleslash

This problem occurs only when activity is set explicitly to landscape
in manifest. Anyway to make it work in landscape?
Thanks

On May 14, 10:16 pm, doubleslash doublesl...@gmail.com wrote:
 I see an acceleration of -9 in the y-direction ( due to gravity, of
 course). Now, keeping the phone fixed, not rotating the screen or
 anything, I interrupt the app my pressing the call button and then
 coming back, I see an acceleration of +9 in the x-direction. This
 switching of the coordinates happens without onAccuracyChanged being
 called, so how on Earth can we consistently use the accelerometer's
 output?

 Please shed some light on this. Is this fixed in SDK 1.5?
--~--~-~--~~~---~--~~
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: Accelerometer power tied to display backlight power

2009-04-20 Thread Jordan Frank

Known but not resolved. Even in the bug report that is mentioned in
the thread that you quoted, the only response has been things might
have changed in cupcake. Of course determining what has changed, or
if this specific problem has been fixed requires wiping the phone and
installing cupcake*, whereas it seems like someone in the know could
say we fixed this, or this is still the behaviour and we could
stop discussing this.

Jordan

* If I haven't heard anything more about this by the end of the week,
I will probably end up wiping and upgrading to cupcake.

On Apr 17, 2:13 pm, Carter ccjerni...@gmail.com wrote:
 This is a known issue.

 See this 
 thread:http://groups.google.com/group/android-developers/browse_thread/threa...

 On Apr 17, 4:18 am, David Burström david.burst...@gmail.com wrote:

  Hi Jordan,

  I can only agree with your findings. Regardless of which lock is being
  used, the service stops sending callbacks as soon as the screen turns
  off or the power button is pressed.

  :David

  On Mar 16, 3:01 pm, Jordan Frank jordan.w.fr...@gmail.com wrote:

   A partial wakelock doesn't help because, as I have already explained,
   as soon as the display goes off, the accelerometers go off. I can keep
   the CPU awake, and my program continues to run when the display is
   off. However, as soon as the display goes off, the accelerometers go
   silent.


--~--~-~--~~~---~--~~
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: Accelerometer power tied to display backlight power

2009-04-20 Thread Jordan Frank

Good news! I upgraded my device to cupcake, and it appears that I can
now receive onSensorChanged events when the screen is off, provided
that I hold a Partial Wake Lock.

However, the sampling frequency seems to be far more sporadic. I think
that it has to do with the fact that cupcake now flips the orientation
of all applications, and when it does the redrawing, it suspends the
application (and thus the sensor listeners). I'm experimenting with
turning this auto-orientation behaviour off (Anyone know how to do
this on an application-by-application basis, rather than turning it
off in the device settings?).

Anyway, things look good for those of us who wanted sensor data
without having to leave the screen on.

Jordan



On Apr 20, 10:55 am, Jordan Frank jordan.w.fr...@gmail.com wrote:
 Known but not resolved. Even in the bug report that is mentioned in
 the thread that you quoted, the only response has been things might
 have changed in cupcake. Of course determining what has changed, or
 if this specific problem has been fixed requires wiping the phone and
 installing cupcake*, whereas it seems like someone in the know could
 say we fixed this, or this is still the behaviour and we could
 stop discussing this.

 Jordan

 * If I haven't heard anything more about this by the end of the week,
 I will probably end up wiping and upgrading to cupcake.

 On Apr 17, 2:13 pm, Carter ccjerni...@gmail.com wrote:

  This is a known issue.

  See this 
  thread:http://groups.google.com/group/android-developers/browse_thread/threa...

  On Apr 17, 4:18 am, David Burström david.burst...@gmail.com wrote:

   Hi Jordan,

   I can only agree with your findings. Regardless of which lock is being
   used, the service stops sending callbacks as soon as the screen turns
   off or the power button is pressed.

   :David

   On Mar 16, 3:01 pm, Jordan Frank jordan.w.fr...@gmail.com wrote:

A partial wakelock doesn't help because, as I have already explained,
as soon as the display goes off, the accelerometers go off. I can keep
the CPU awake, and my program continues to run when the display is
off. However, as soon as the display goes off, the accelerometers go
silent.


--~--~-~--~~~---~--~~
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: Accelerometer power tied to display backlight power

2009-04-17 Thread David Burström

Hi Jordan,

I can only agree with your findings. Regardless of which lock is being
used, the service stops sending callbacks as soon as the screen turns
off or the power button is pressed.

:David

On Mar 16, 3:01 pm, Jordan Frank jordan.w.fr...@gmail.com wrote:
 A partial wakelock doesn't help because, as I have already explained,
 as soon as the display goes off, the accelerometers go off. I can keep
 the CPU awake, and my program continues to run when the display is
 off. However, as soon as the display goes off, the accelerometers go
 silent.

--~--~-~--~~~---~--~~
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: Accelerometer power tied to display backlight power

2009-04-17 Thread Carter

This is a known issue.

See this thread: 
http://groups.google.com/group/android-developers/browse_thread/thread/1b7202c957084742

On Apr 17, 4:18 am, David Burström david.burst...@gmail.com wrote:
 Hi Jordan,

 I can only agree with your findings. Regardless of which lock is being
 used, the service stops sending callbacks as soon as the screen turns
 off or the power button is pressed.

 :David

 On Mar 16, 3:01 pm, Jordan Frank jordan.w.fr...@gmail.com wrote:



  A partial wakelock doesn't help because, as I have already explained,
  as soon as the display goes off, the accelerometers go off. I can keep
  the CPU awake, and my program continues to run when the display is
  off. However, as soon as the display goes off, the accelerometers go
  silent.
--~--~-~--~~~---~--~~
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: Accelerometer/Orientation sensor problem

2009-04-03 Thread chow

I have noticed that the speaker output does effect the magnetic
compass reading a bit. Not too surprising, since the speaker uses an
electromagnet. This is probably what is causing the sensor to jitter
around. As for the accelerometers, I would guess that the movement of
the speaker cone itself is what is causing the fluctuations there.
Perhaps its not a problem, but more of a filtering issue, have your
tried any simple averaging on the sensor output?

chow

On Mar 31, 11:55 am, Liz lizzie...@gmail.com wrote:
 On my T-Mobile G1 (firmware 1.1, build PLAT-RC33), developing in
 SDK1.1r1,  I am experiencing a problem where playing sounds causes the
 output of the accelerometer and orientation sensors to fluctuate
 wildly.     The degree of fluctuation is directly proportional to the
 volume of the sound being played.

 I am using SensorManager per the documentation and examples :

 =  From my implementation of SensorListener
 public void init() {
     SensorManager sm = (SensorManager) cx..getSystemService
 (Context.SENSOR_SERVICE);
     boolean success = sm.registerListener(this,
          SensorManager.SENSOR_ORIENTATION,
          SensorManager.SENSOR_DELAY_GAME);
     // success is true, i.e. no problems acquiring the sensor

 }

 public void onSensorChanged(int sensor, float[] values) {
     if (sensor == SensorManager.SENSOR_ORIENTATION) {
          // print/draw/do something with the sensor output in values[]
     }}

 ==

 I have tried playing sounds with both SoundPool and MediaPlayer, with
 identical results.   When a sample is played at max volume the
 Orientation sensor outputs will bounce around as much as +-/30
 degrees.   All axes are affected.

 I have tested and confirmed this behaviour for SENSOR_ACCELEROMETER,
 SENSOR_ORIENTATION, and SENSOR_ORIENTATION_RAW.  Other sensors may
 also be impacted, but I haven't tested them.

 I have also tested with all of the available sensor sampling rates --
 SENSOR_DELAY_FASTEST through SENSOR_DELAY_UI.   All result in the same
 behavior.

 On a random guess I tried muting the microphone with
 AudioManager.setMicrophoneMute(true) -- same results.

 I thought to try testing this in the Android emulator to see if it
 might be hardware-related, but unfortunately there is currently no
 accelerometer/orientation sensor support in the emulator.

 Is this a known problem?  Or am I doing something wrong here?

 Thanks

--~--~-~--~~~---~--~~
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: Accelerometer or orientation for rolling ball code?

2009-03-23 Thread clark

IMO, I'd go with the accelerometer implementation.  The reason being
that for a rolling ball you could use the values for the X and Y axis,
perhaps scale them a bit to meet your needs.  I've done exactly that
on a test application I was working on.  Going with the orientation
implementation, you would have to do some calculations to get the x
and y forces, which would not be all that difficult.


It may be a matter of preference but for me the simple way seems to be
to use the accelerometer.


~clark


On Mar 23, 3:20 pm, Carl Whalley carl.whal...@googlemail.com wrote:
 If I'm reading things right, the accelerometer measures physical
 forces (i.e. movement) and the orientation sensor gives the tilt of
 the handset. If you are coding a rolling ball type app which would you
 use? You could argue accelerometer, in which case you measure each
 delta force and apply it to your balls physics. Or just the
 orientation and compute the effects of gravity again on the ball but
 just using different physics. Is there a preference? Would any be more
 accurate than the other?

 --
 Android Academyhttp://www.androidacademy.com
--~--~-~--~~~---~--~~
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: Accelerometer power tied to display backlight power

2009-03-16 Thread Jordan Frank

A partial wakelock doesn't help because, as I have already explained,
as soon as the display goes off, the accelerometers go off. I can keep
the CPU awake, and my program continues to run when the display is
off. However, as soon as the display goes off, the accelerometers go
silent.

So this is why I think that the solution lies in one of the lower
layers, I'm just not sure where to start digging.

Cheers,
Jordan

On Mar 15, 12:35 pm, Marco Nelissen marc...@android.com wrote:
 That's why you'd use a *partial* wakelock.

 On Sun, Mar 15, 2009 at 6:57 AM, Jordan Frank jordan.w.fr...@gmail.com 
 wrote:

  My fault for not explaining myself better. I want to still be able to
  collect accelerometer data while the display is off. I'm well aware of
  the fact that I can keep the display on, but if I want to, for
  instance, create a pedometer application that counts footsteps while
  in the user's pocket, then the last thing I want is to keep the
  display to be on the whole time.

  Cheers,
  Jordan

  On Mar 14, 3:20 pm, Stoyan Damov stoyan.da...@gmail.com wrote:
 http://developer.android.com/reference/android/os/PowerManager.WakeLo...

  On Sat, Mar 14, 2009 at 8:23 PM, Jordan Frank jordan.w.fr...@gmail.com 
  wrote:

   Hi,

   Although I haven't received confirmation from anyone at Google, I can
   confidently state that when the power to the display goes off, one can
   no longer obtain data from the accelerometers. I can easily think of a
   number of examples of where one would like to continue collecting
   accelerometer data even when the display is of.

   Supposing that I wanted to fix this, can anyone suggest where should
   I start looking? Would this be in the SDK, the kernel, or in some
   proprietary firmware that I can't touch?

   Thanks,
   Jordan Frank


--~--~-~--~~~---~--~~
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: Accelerometer power tied to display backlight power

2009-03-15 Thread Jordan Frank

My fault for not explaining myself better. I want to still be able to
collect accelerometer data while the display is off. I'm well aware of
the fact that I can keep the display on, but if I want to, for
instance, create a pedometer application that counts footsteps while
in the user's pocket, then the last thing I want is to keep the
display to be on the whole time.

Cheers,
Jordan

On Mar 14, 3:20 pm, Stoyan Damov stoyan.da...@gmail.com wrote:
 http://developer.android.com/reference/android/os/PowerManager.WakeLo...

 On Sat, Mar 14, 2009 at 8:23 PM, Jordan Frank jordan.w.fr...@gmail.com 
 wrote:

  Hi,

  Although I haven't received confirmation from anyone at Google, I can
  confidently state that when the power to the display goes off, one can
  no longer obtain data from the accelerometers. I can easily think of a
  number of examples of where one would like to continue collecting
  accelerometer data even when the display is of.

  Supposing that I wanted to fix this, can anyone suggest where should
  I start looking? Would this be in the SDK, the kernel, or in some
  proprietary firmware that I can't touch?

  Thanks,
  Jordan Frank


--~--~-~--~~~---~--~~
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: Accelerometer power tied to display backlight power

2009-03-14 Thread Stoyan Damov

http://developer.android.com/reference/android/os/PowerManager.WakeLock.html

On Sat, Mar 14, 2009 at 8:23 PM, Jordan Frank jordan.w.fr...@gmail.com wrote:

 Hi,

 Although I haven't received confirmation from anyone at Google, I can
 confidently state that when the power to the display goes off, one can
 no longer obtain data from the accelerometers. I can easily think of a
 number of examples of where one would like to continue collecting
 accelerometer data even when the display is of.

 Supposing that I wanted to fix this, can anyone suggest where should
 I start looking? Would this be in the SDK, the kernel, or in some
 proprietary firmware that I can't touch?

 Thanks,
 Jordan Frank

 


--~--~-~--~~~---~--~~
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: Accelerometer frequency

2009-02-19 Thread Jordan Frank

I've done some experiments with the accelerometers, and so I figured
that I would share the results.

As for precision, the values are floats. I don't know how else to
quantify the precision without looking at the specs for the actual
sensors being used. Qualitatively, the noise in these sensors is very
low. I've worked with accelerometers in other devices, and the G1
sensors have the least amount of noise of all the sensors that I've
used. For my experiments, I'm not interested in large forces, more the
kind that occur during natural human motion. The sensor readings tend
to lie in the (-3g,3g) range.

In the documentation, it says that there are 6 sensor values:
x,y,z,raw_x,raw_y,raw_z. The documentation states that the x,y,z
values may be smoothed, while the raw ones are the raw sensor
readings. However, on the G1, the raw readings are identical to the
smoothed readings. One thing that I'm suspicious of is that the low
noise in the readings is actually due to the G1 doing some smoothing
of the data, and the raw values aren't in fact the raw values, but are
also smoothed. I'm not sure how to figure out if this is what is
really happening.

I first tried SENSOR_DELAY_FASTEST. I collected data over a 15 minute
period. The average frequency was 21.0025, with standard deviation of
8.0061. I then tried SENSOR_DELAY_GAME, and found that the frequency
was more consistent. I went for a 2 minute walk and the average
frequency was 40.2894 with a standard deviation of only 3.3162.

I hope that someone finds this useful.

Cheers,
Jordan Frank


On Feb 18, 2:08 am, gjs garyjamessi...@gmail.com wrote:
 Hi,

 Try logging the data received with timestamps ( in memory ) for
 android.hardware.SensorListener.onSensorChanged(int sensor, float[]
 values) and you'll soon work out the Frequency, I have found
 accelerometer updates being received at approximately 30~40ms
 intervals on a G1 eg:

 1227266554492 2 [0] = 0.16344418 [1] = -9.629586 [2] = -1.3620348 [3]
 = 0.16344418 [4] = -9.629586 [5] = -1.3620348
 1227266554495 1 [0] = 7.3883734 [1] = -82.0 [2] = 1.0 [3] = 7.3883734
 [4] = -82.0 [5] = 1.0
 1227266554525 8 [0] = 8.3125 [1] = 12.875 [2] = -71.5625 [3] = 8.3125
 [4] = 12.875 [5] = -71.5625
 1227266554528 2 [0] = 0.05448139 [1] = -9.684067 [2] = -1.3075534 [3]
 = 0.05448139 [4] = -9.684067 [5] = -1.3075534
 1227266554531 1 [0] = 7.5050936 [1] = -82.0 [2] = 0.0 [3] = 7.5050936
 [4] = -82.0 [5] = 0.0
 1227266554564 8 [0] = 8.5625 [1] = 12.125 [2] = -71.5625 [3] = 8.5625
 [4] = 12.125 [5] = -71.5625
 1227266554566 2 [0] = 0.040861044 [1] = -9.670447 [2] = -1.3211738 [3]
 = 0.040861044 [4] = -9.670447 [5] = -1.3211738
 1227266554603 8 [0] = 8.0625 [1] = 12.375 [2] = -71.8125 [3] = 8.0625
 [4] = 12.375 [5] = -71.8125
 1227266554606 2 [0] = -0.013620348 [1] = -9.724928 [2] = -1.2666923
 [3] = -0.013620348 [4] = -9.724928 [5] = -1.2666923
 1227266554609 1 [0] = 7.5050936 [1] = -83.0 [2] = 0.0 [3] = 7.5050936
 [4] = -83.0 [5] = 0.0
 1227266554643 8 [0] = 8.3125 [1] = 12.375 [2] = -71.8125 [3] = 8.3125
 [4] = 12.375 [5] = -71.8125
 1227266554646 2 [0] = -0.013620348 [1] = -9.615966 [2] = -1.2666923
 [3] = -0.013620348 [4] = -9.615966 [5] = -1.2666923
 1227266554649 1 [0] = 7.5050936 [1] = -82.0 [2] = 0.0 [3] = 7.5050936
 [4] = -82.0 [5] = 0.0
 1227266554683 8 [0] = 7.8125 [1] = 11.625 [2] = -71.5625 [3] = 7.8125
 [4] = 11.625 [5] = -71.5625
 1227266554686 2 [0] = 0.040861044 [1] = -9.615966 [2] = -1.2666923 [3]
 = 0.040861044 [4] = -9.615966 [5] = -1.2666923

 (These examples were when using SENSOR_DELAY_GAME rate, you can
 probably do better if you listen just for the accelerometer updates
 and use a faster RATE)

 You can also vary this Frequency (rate) with
 android.hardware.SensorManager.registerListener(SensorListener
 listener, int sensors, int rate)

 int     SENSOR_DELAY_FASTEST    get sensor data as fast as possible
 int     SENSOR_DELAY_GAME       rate suitable for games
 int     SENSOR_DELAY_NORMAL     rate (default) suitable for screen orientation
 changes
 int     SENSOR_DELAY_UI rate suitable for the user interface

 I can't help you with the Precision, maybe have a look at
 android.hardware.SensorListener.onAccuracyChanged (int sensor, int
 accuracy).

 Another idea is to find the specs for the sensor being used in the g1
 or g2, but there is nothing like measuring it for yourself

 Regards

 On Feb 17, 8:39 pm, ashu montoo...@gmail.com wrote:

  So my question still stands.  Frequency? Precision?  Thanks for the
  attempt, Jubei.

  On Feb 11, 6:14 am, Jubei nkatza...@gmail.com wrote:

   Supposedly you pass a 3rd parameter to the sensormanager's
   registerLister function but It doesnt seem to make any difference.

   On Feb 11, 7:33 pm,ashumontoo...@gmail.com wrote:

Hey, I wanted to get the frequency of accelerometer output.  How many
readings can I get per second?  And to what precision do I get?  
Thanks- Hide quoted text -

   - Show quoted text -




[android-developers] Re: Accelerometer frequency

2009-02-17 Thread ashu

So my question still stands.  Frequency? Precision?  Thanks for the
attempt, Jubei.

On Feb 11, 6:14 am, Jubei nkatza...@gmail.com wrote:
 Supposedly you pass a 3rd parameter to the sensormanager's
 registerLister function but It doesnt seem to make any difference.

 On Feb 11, 7:33 pm,ashumontoo...@gmail.com wrote:



  Hey, I wanted to get the frequency of accelerometer output.  How many
  readings can I get per second?  And to what precision do I get?  Thanks- 
  Hide quoted text -

 - Show quoted text -
--~--~-~--~~~---~--~~
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: Accelerometer frequency

2009-02-17 Thread gjs

Hi,

Try logging the data received with timestamps ( in memory ) for
android.hardware.SensorListener.onSensorChanged(int sensor, float[]
values) and you'll soon work out the Frequency, I have found
accelerometer updates being received at approximately 30~40ms
intervals on a G1 eg:

1227266554492 2 [0] = 0.16344418 [1] = -9.629586 [2] = -1.3620348 [3]
= 0.16344418 [4] = -9.629586 [5] = -1.3620348
1227266554495 1 [0] = 7.3883734 [1] = -82.0 [2] = 1.0 [3] = 7.3883734
[4] = -82.0 [5] = 1.0
1227266554525 8 [0] = 8.3125 [1] = 12.875 [2] = -71.5625 [3] = 8.3125
[4] = 12.875 [5] = -71.5625
1227266554528 2 [0] = 0.05448139 [1] = -9.684067 [2] = -1.3075534 [3]
= 0.05448139 [4] = -9.684067 [5] = -1.3075534
1227266554531 1 [0] = 7.5050936 [1] = -82.0 [2] = 0.0 [3] = 7.5050936
[4] = -82.0 [5] = 0.0
1227266554564 8 [0] = 8.5625 [1] = 12.125 [2] = -71.5625 [3] = 8.5625
[4] = 12.125 [5] = -71.5625
1227266554566 2 [0] = 0.040861044 [1] = -9.670447 [2] = -1.3211738 [3]
= 0.040861044 [4] = -9.670447 [5] = -1.3211738
1227266554603 8 [0] = 8.0625 [1] = 12.375 [2] = -71.8125 [3] = 8.0625
[4] = 12.375 [5] = -71.8125
1227266554606 2 [0] = -0.013620348 [1] = -9.724928 [2] = -1.2666923
[3] = -0.013620348 [4] = -9.724928 [5] = -1.2666923
1227266554609 1 [0] = 7.5050936 [1] = -83.0 [2] = 0.0 [3] = 7.5050936
[4] = -83.0 [5] = 0.0
1227266554643 8 [0] = 8.3125 [1] = 12.375 [2] = -71.8125 [3] = 8.3125
[4] = 12.375 [5] = -71.8125
1227266554646 2 [0] = -0.013620348 [1] = -9.615966 [2] = -1.2666923
[3] = -0.013620348 [4] = -9.615966 [5] = -1.2666923
1227266554649 1 [0] = 7.5050936 [1] = -82.0 [2] = 0.0 [3] = 7.5050936
[4] = -82.0 [5] = 0.0
1227266554683 8 [0] = 7.8125 [1] = 11.625 [2] = -71.5625 [3] = 7.8125
[4] = 11.625 [5] = -71.5625
1227266554686 2 [0] = 0.040861044 [1] = -9.615966 [2] = -1.2666923 [3]
= 0.040861044 [4] = -9.615966 [5] = -1.2666923

(These examples were when using SENSOR_DELAY_GAME rate, you can
probably do better if you listen just for the accelerometer updates
and use a faster RATE)

You can also vary this Frequency (rate) with
android.hardware.SensorManager.registerListener(SensorListener
listener, int sensors, int rate)

int SENSOR_DELAY_FASTESTget sensor data as fast as possible
int SENSOR_DELAY_GAME   rate suitable for games
int SENSOR_DELAY_NORMAL rate (default) suitable for screen orientation
changes
int SENSOR_DELAY_UI rate suitable for the user interface

I can't help you with the Precision, maybe have a look at
android.hardware.SensorListener.onAccuracyChanged (int sensor, int
accuracy).

Another idea is to find the specs for the sensor being used in the g1
or g2, but there is nothing like measuring it for yourself

Regards

On Feb 17, 8:39 pm, ashu montoo...@gmail.com wrote:
 So my question still stands.  Frequency? Precision?  Thanks for the
 attempt, Jubei.

 On Feb 11, 6:14 am, Jubei nkatza...@gmail.com wrote:

  Supposedly you pass a 3rd parameter to the sensormanager's
  registerLister function but It doesnt seem to make any difference.

  On Feb 11, 7:33 pm,ashumontoo...@gmail.com wrote:

   Hey, I wanted to get the frequency of accelerometer output.  How many
   readings can I get per second?  And to what precision do I get?  Thanks- 
   Hide quoted text -

  - Show quoted text -
--~--~-~--~~~---~--~~
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: Accelerometer frequency

2009-02-11 Thread Jubei

Supposedly you pass a 3rd parameter to the sensormanager's
registerLister function but It doesnt seem to make any difference.

On Feb 11, 7:33 pm, ashu montoo...@gmail.com wrote:
 Hey, I wanted to get the frequency of accelerometer output.  How many
 readings can I get per second?  And to what precision do I get?  Thanks

--~--~-~--~~~---~--~~
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: Accelerometer sensors shut off during sleep?

2008-11-20 Thread songs

I can get this to work if I hold a partial dim wake lock, but I'd
rather not keep the screen on if I don't have to.

On Nov 19, 2:25 am, songs [EMAIL PROTECTED] wrote:
 Hi,

 Do the accelerometer sensors shut off during sleep mode even if I have
 a partial wake lock?  I've got my sensor code service doing what I
 want as long as the phone is awake, and I was hoping that holding a
 partial wake lock would enable it to do the same when the phone is
 asleep since the documentation says that the CPU still runs, but it
 doesn't seem to work.  Is there something else I need to do to get the
 desired behavior?

 Thanks,
 Steve
--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



  1   2   >