android-sensors

Android Compass that can Compensate for Tilt and Pitch

≯℡__Kan透↙ 提交于 2019-11-26 15:07:43
I'm trying to make a application on my Android phone (Nexus 4), which will be used in a model boat. I've added low pass filters to filter out the gitter from the sensors. However, the compass is only stable when the phone is flat on its back. If I tilt it up, (such as turning a page of a booK), then the compass heading goes way off - as much as 50*. I've tried this with Sensor.TYPE_MAGNETIC_FIELD with either Sensor.TYPE_GRAVITY and Sensor.TYPE_ACCELEROMETER and the effect is the same. I've used the solution mentioned here , and many other places. My maths is not great but this must be a common

Get temperature of battery on android

爱⌒轻易说出口 提交于 2019-11-26 09:34:00
问题 How do I get the temperature of the battery in android? 回答1: Try this: private class mBatInfoReceiver extends BroadcastReceiver{ int temp = 0; float get_temp(){ return (float)(temp / 10); } @Override public void onReceive(Context arg0, Intent intent) { temp = intent.getIntExtra(BatteryManager.EXTRA_TEMPERATURE,0); } }; then define in your Variable declarations: private mBatInfoReceiver myBatInfoReceiver; and in onCreate: @Override public void onCreate(Bundle b) { super.onCreate(b);

My Algorithm to Calculate Position of Smartphone - GPS and Sensors

蓝咒 提交于 2019-11-26 08:50:18
I am developing an android application to calculate position based on Sensor's Data Accelerometer --> Calculate Linear Acceleration Magnetometer + Accelerometer --> Direction of movement The initial position will be taken from GPS (Latitude + Longitude). Now based on Sensor's Readings i need to calculate the new position of the Smartphone: My Algorithm is following - (But is not calculating Accurate Position): Please help me improve it. Note: My algorithm Code is in C# (I am sending Sensor Data to Server - Where Data is stored in the Database. I am calculating the position on Server) All

What is the alternative to android orientation sensor?

ε祈祈猫儿з 提交于 2019-11-26 08:16:46
问题 Hi I am building a 3D game for Android. I am currently trying to add a sensor to my game that allows the player to tilt the android as its controls. Ideally I would like to use the ORIENTATION sensor, but I noticed it has been deprecated. Does anyone know how to detect tilt in the android and doesn\'t use this sensor? 回答1: There is no actual "orientation" sensor - this is (was) actually a composite sensor, generated from a combination of the accelerometer and the magnometer. From http:/

Convert magnetic field X, Y, Z values from device into global reference frame

不打扰是莪最后的温柔 提交于 2019-11-26 06:01:53
问题 When you use TYPE_MAGNETOMETER sensor, you get X, Y, Z values of magnetic field strength in relation to the device orientation. What I want to get is to convert these values into global reference frame, clarifying: user takes the device, measure these values, than rotate the device for some degrees around any axis and gets ~the same values. Please, find similar questions below: Getting magnetic field values in global coordinates How can I get the magnetic field vector, independent of the

How to use Accelerometer to measure distance for Android Application Development

淺唱寂寞╮ 提交于 2019-11-26 04:23:30
问题 I am just a beginner in the application development industry. I know the accelerometer can be used to return the current acceleration along three axis in meters per second squared (m/s2). But I have come to know that an accelerometer can also be use as speedometer. I want to know how I can use accelerometer to determine distance traveled by Android device between points of interest. If it is possible, then how can I implement it? I have seen a similar question \"how do I measure the distance

Android Compass that can Compensate for Tilt and Pitch

风流意气都作罢 提交于 2019-11-26 04:13:05
问题 I\'m trying to make a application on my Android phone (Nexus 4), which will be used in a model boat. I\'ve added low pass filters to filter out the gitter from the sensors. However, the compass is only stable when the phone is flat on its back. If I tilt it up, (such as turning a page of a booK), then the compass heading goes way off - as much as 50*. I\'ve tried this with Sensor.TYPE_MAGNETIC_FIELD with either Sensor.TYPE_GRAVITY and Sensor.TYPE_ACCELEROMETER and the effect is the same. I\

My Algorithm to Calculate Position of Smartphone - GPS and Sensors

十年热恋 提交于 2019-11-26 03:26:59
问题 I am developing an android application to calculate position based on Sensor\'s Data Accelerometer --> Calculate Linear Acceleration Magnetometer + Accelerometer --> Direction of movement The initial position will be taken from GPS (Latitude + Longitude). Now based on Sensor\'s Readings i need to calculate the new position of the Smartphone: My Algorithm is following - (But is not calculating Accurate Position): Please help me improve it. Note: My algorithm Code is in C# (I am sending Sensor

How do I find out if the GPS of an Android device is enabled

会有一股神秘感。 提交于 2019-11-25 23:33:31
问题 On an Android Cupcake (1.5) enabled device, how do I check and activate the GPS? 回答1: Best way seems to be the following: final LocationManager manager = (LocationManager) getSystemService( Context.LOCATION_SERVICE ); if ( !manager.isProviderEnabled( LocationManager.GPS_PROVIDER ) ) { buildAlertMessageNoGps(); } private void buildAlertMessageNoGps() { final AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage("Your GPS seems to be disabled, do you want to enable it?