Android :: Add New Sensor Support In Sensor Framework
Nov 18, 2009Can some one point towards any documentation/resources/ threads that can explain how a new sensor support can be added in android sensor framework?
View 2 RepliesCan some one point towards any documentation/resources/ threads that can explain how a new sensor support can be added in android sensor framework?
View 2 RepliesI have a HTC Hero here, and when I tried to get the list of available sensors on the device by calling ((SensorManager) getSystemService (Context.SENSOR_SERVICE)) .getSensorList(Sensor.TYPE_ALL); I get only the following sensors: D/SensorManager( 6302): found sensor: BMA150 3-axis Accelerometer, handle=0 D/SensorManager( 6302): found sensor: AK8973 3-axis Magnetic field sensor, handle=1 D/SensorManager( 6302): found sensor: AK8973 Orientation sensor, handle=2 D/SensorManager( 6302): found sensor: AK8973 Temperature sensor, handle=3 According to the specs, there should be a light and a proximity sensor on the Hero, and I've seen it in action (the automatic screen brightness adjustment) - so at least the ambient light sensor is definitely there. My question is then, why doesn't the getSensorList return for me the light and the proximity sensors?
View 8 Replies View RelatedDoes anyone know the difference between the orientation sensor and magnetic field sensor on Android?Since I've read that magnetometer is synonymous with digital compass I'm a little bit confused. What are they really?
View 1 Replies View RelatedOr it's just some virtual sensor the uses the data provided by the accelerometer and the magnetic field sensor to calculate the orientation?
View 7 Replies View RelatedMy home icon is way less responsive than the back icon which seems to be perfectly normal. Sometimes I have to "press" the home icon twice to get the "buzz" and have it move the screen. However the back icon works 99% of the time on the first press. IS there any adjustment I can make or should I bring the phone back. I have had it now for 2 weeks.
View 9 Replies View RelatedI had a discussion with a few of the Android team member at Google IO, and I'd like to throw the idea out here for general brainstorming with the community. My view is that it is not a good approach to create "sensor-specific" APIs with iterative releases of the Android platform and SDK's. By this, I mean that instead of adding a "location API", and an "accelerometer API", and whatever comes next, we should create a "generic" sensor API that can work with a broad range of sensor types, including sensor configuration, demand read/write/configuration, event notifications, and other functions. In this way, 3rd parties could also add innovative sensing capabilities (or external sensors) to their Android devices which would be "instantly" supported by the platform. Well-known sensor such as collocation and acceleration could have agreed-to sensor names/namespaces, with full extensibility for additional sensor types. As an example, collocation as a 2D longitude/latitude is fine for some apps, but for "inside the building" applications or for other apps involving the need to accurate location of people or resources in 3 dimensions, it doesn't cut it. Additionally, one can easily envision inclusion of RFID, environmental, and other sensors in devices that could dramatically enhance the capabilities of Android applications.
View 4 Replies View RelatedWhere can I find a simple example application that uses the Accelerometer Sensor?
I've seen the Open Intents applications, but I'd rather use the raw Android API, at least until I understand it a little better. I'm surprised at the lack of documentation.
I am currently working with a HTC G1 and I am trying to retrieve my GPS position. But I can not understand very well the documentation. I wrote those lines, but they didn't work.It already write "provider == null" so I guess that "mgr.getBestProvider(new Criteria(), true);" returns null.
View 2 Replies View RelatedI just got an android, and I love it. But I was wondering if there is an app where it records video, but it automatically starts recording when there is motion, and stops when the motion goes away. I believe its possible, just wondering if is been done.
View 2 Replies View Relatedsince map overlay is not activity, how do i get the sensor data so that i can draw on the map overlay? like the direction arrow.
View 7 Replies View RelatedAm researching a problem with compass and sensor values returned by the phone. I found this thread: http://groups.google.com/group/android-developers/browse_thread/threa. Which seems related, but it's old so I'm starting a new one. I'm getting stuck values from both the compass and orientation sensors. It was fine yesterday, but today, I'm only getting values in a limited range (e.g. compass headings from 240 - 290), no matter how I orient the device. What's even more odd is that the radians returned from the call to Sensor Manager.get Orientation(), which returns radians, is giving consistently out of range values. Anyone see this same behavior, and if so, any fixes? Here's some sample sensor data. Format is heading, pitch, roll. The first set contains raw values, the second set contains values after I've applied the orientation matrix generated by the Sensor Manager. The third set contains values after I've smoothed the data with my own algorithm.
View 4 Replies View RelatedI am listening events from accelerometer sensor and everything is going right. The problem occurs when phone gets in standby mode and I am not being notified by sensors anymore. Does Anyone know if it's possible to get sensor notifications, by implementing a listener, even if phone is in standby?
View 2 Replies View RelatedI'm having some troubles with the light sensor on the Nexus One.
AFAIK, the proper way to read the measures of a sensor is registering a SensorListener through the SensorManager and then wait for the readings on the onSensorChanged method.
My main problem is that the light sensor don't seem very accurate (the readings jump a lot) and I don't get the first reading until the lighting conditions change. I have to change the phone orientation, go outdoors or hide the sensor with my fingers or otherwise I don't receive any value. Is there any way to increase the accuracy or, even more important, to force an initial reading?
BTW, I have tried with SensorManager.SENSOR_DELAY_FASTEST but I haven't noticed any change.
We are writing an application that uses acceleration sensor data to plot phone's movement in 3D. We are finding gross inconsistencies in the actual data output by the sensor. Also, sampling rates vary greatly from 8 to 200 millis. (using System.currentTimeMillis())
Specifically, when we try to draw a circle with G1 flat on the table all the time (filtering out gravity accel 9.8), most of the time we would get a plot of phone's position that is not a circle at all. Lots of times, it would be close to a straight line. Sometimes, it would start drawing an arc, but would not close the circle shooting off in a random direction.
We tried to eliminate the time variable, by substituting a constant time sampling rate (10 millis) to calculate phones position, but the result was very close to what we had before (shapewise). Also, the acceleration in Z direction when the phone is displaced lying flat on a table (XY plane) varies too by +/- 2 units which is a lot.
I do not think it is an error in our code, as we have checked it many times. If there were an error indeed and the accelerometer worked properly, we would see a consistently wrong depiction of the phone's movement. Unfortunately, repeating the same movement (circle) would produce sometimes wildly differently shaped plots.
It all comes down to us wanting to know if that is indeed the case that the G1 accelerometer is very unreliable and inconsistent device when used for more or less precise measurements? Is there some documentation/facts paper that would tell us just how reliable accelerometer is?
Yes, I can get sensor update events with SensorEventListener. But this approach has 2 drwwbacks:
1) For some sensors I have to wait for the state to update. For example, temperature may update after a minute!
2) In some cases I can get incorrect readings. For example, the phone lies on a flat surface and does not move. I receive first orientation update event after listener registration. When only a part of the orientation vector changes, other parts may be 0. And it is no way to determine, is it a true 0 degree azimuth or just an incomplete vector. If I move the phone a little, the correct non-zero azimuth appears.
To solve this problems it's possible to create a separate thread that constantly monitors sensors. After some time it will certainly contain true values. But I think that it is an overhead for such simple task.
Is it any other way to get current sensor data?
Could somebody (Mathias Agopian alias pixelflinger perhaps) please tell me how to use information from sensor for augmented reality stuff. Sorry am not much into graphics stuff but I did try my part to figure stuff out with help of documentation. Didn't miss the note: ""Note: It is preferable to use getRotationMatrix() in conjunction with remapCoordinateSystem() and getOrientation() to compute these values; while it may be more expensive, it is usually more accurate. Tried both. With the above method roll is always negative (in radians) of the roll returned by orientation sensor event. Not the real problem though as these are in the same +/-90 range but negative/opposite. One of these goes against the definition of roll in android documentation. I have the camera on landscape mode and did try with and without the suggestion: ""# Using the camera (Y axis along the camera's axis) for an augmented reality application where the rotation angles are needed : remapCoordinateSystem(inR, AXIS_X, AXIS_Z, outR); Yet no luck. Got a few lessons on quaternions etc. But am sure it is much easier than the mess am getting into. Say, orientation sensor event returns yaw, pitch & roll in say eO[] What are the next steps to get rotation matrix that I could use in opengl to rotate a augmented scene overlapping the camera preview?
View 7 Replies View RelatedIs this possible to access a sensor data form native code without using Java at all? I need to access to the sensor as fast as possible, but it seems like the "DELAY_FASTEST" parameter when registering an event change is not fast enough.
View 3 Replies View RelatedWhen you talk on the phone in Android the light sensor is working. If you cover the top left corner of the screen, the display turns black and you can't see anything. I would like to cancel that feature and I tried working with Android Sensors and the Light Sensor but it is not working. This is my code:
senMgrLight=(SensorManager)getSystemService(Context.SENSOR_SERVICE);
senMgrLight.registerListener(onSensorListener,
senMgrLight.getDefaultSensor(Sensor.TYPE_LIGHT),
SensorManager.SENSOR_DELAY_FASTEST);
I have two questions about sensor listeners
1. from which thread are sensor values updated and should this be synchronized? can sensor's listener callback be a good place to call custom's view onDraw method? as this should be done from different thread. I cant find anything about it. In another words my problem is that I want to listen to sensors change and draw something on view surface but I dont know which thread (the main thread of the application?) is updating sensor's state
2. If I register sensor listener with SENSOR_DELAY_FASTEST my application is not responsive at all! Raw application with TextView only is not reacting to go back or home button! How should I deal with this or am I doing something wrong?
Is it the SensorManager API that i have to use to measure steps? Any sample code or tutorial?
View 1 Replies View RelatedI'm trying to detect landscape vs portrait orientation with the following:
public void onSensorChanged(SensorEvent event) { float pitch = event.values[2];
if (pitch <= 45 && pitch >= -45) { // portrait }
else if (pitch < -45) { // landscape }
else if (pitch > 45) { // landscape } }
Anyone have something more robust? It works pretty well, except if the phone is in a landscape orientation and the user starts to 'flatten' it out, starts thinking it's in the portrait orientation again.
Just joined the Android group. I'm having problems with the acceleration and orientation sensors.I would like to obtain sensor data (acceleration and orientation values) at regular intervals (10 milliseconds). However, the SensorEventListener doesn't allow you to do that. Does anyone have an idea of how to work around this issue? This is important as I need it to collect data for an app I'm working on.
View 2 Replies View RelatedPer the current implementation in Sensor Manager, the SensorThread is polling data per below code, final int sensor = sensors_data_poll(values, status, timestamp); it then checks the sensor type if it is registered and processes the data further. For an application which has registered for only one sensor, still to get that particular sensor data, SensorThread has to execute for atleast N-1 loop most of the time. Can anybody provide the insight as to, why SensorThread is waiting to check the sensor type to be returned by the HAL instead of sending sensor information which is currently registered by that application. Wouldn't that increase the performance?
View 2 Replies View RelatedI am working on a project using HTC magic which requires the data from the electronic compass, including both the accelerometer and magnetic sensor. But I find that there is a significant latency between the move of the phone and the trigger of the sensorChanged event. In other word, the acceleration and magnetic data obtained from sensor are updated about half of a second after my motion. And I have several questions about the problem as follow. Are the orientation data computed by the acceleration and magnetic data? Or are there a physical sensor for orientation? Does the latency result from the android API (using the event) or the physical limitation of the electronic compass? It is said that the model of the electronic compass is AK8976A from Asahi Kasei. Does anybody have the datasheet or know the frequency of the sampling? Any idea to improve the real-time experience?
View 1 Replies View RelatedI know the Android SDK provides many Sensor class to use to get data or do something. I already verified my driver of sensor to get data successfully under linux kernel-2.6.29 I use I2C protocol to communication with my device, so I put sensor code under drivers/i2c/chips NOW I want to add my sensor into Android and I hope to link Android Sensor class with my device to reduce develop my application. How to do for this goal? Could I need to modify application framework or Libraries or another driver type for new device? I big your help
View 3 Replies View RelatedI have an application that needs to turn on/off the screen using the proximity sensor like what most dialer applications do when a user is making a phone call. I cannot seem to find a way to turn on/off the screen at will.
View 2 Replies View RelatedI am writing a program and I am able to get the light sensor value and current battery level, but only the light value changes and when the battery level changes. Is there a way to get these two values anytime? Like when a user runs my program, I would like to grab the current values right away instead of having to wait for them to change.
View 2 Replies View RelatedDoes anyone know of a walk-through or any examples of any code to setup sensors in android. I have the drivers available to me. Also i have implemented the sensors library as instructed in the Android-Reference along the sensors.h template. I am still unable to get any response at the apps level. How do i trace this issue? what might be the problem?
View 1 Replies View RelatedI'm interested in developing some software for the android OS using acceleration sensor and I would like to know how precise this technology is in mobile phones ? so I wont be waiting my time.If anyone know something please share!
View 3 Replies View RelatedOn threads about the lag issue it was recomended to do a g-sensor calibration. Before I did one I had no noticible lag but the posters said this would increase responce. So I did a g-sensor calibration and now I have a noticible lag while scrolling. Any thought on this and what could be happening. The fact that the response changed gives me hope it could be corrected through settings or software updates. But just maybe it is a bad idea to follow all advice one sees on here.
View 5 Replies View Related