android-sensors

How is it possible that Google Fit app measures number of steps all the time without draining battery?

倾然丶 夕夏残阳落幕 提交于 2019-12-18 10:44:44
问题 The Google Fit app, when installed, measures the duration you are walking or running, and also the number of steps all the time . However, strangely, using it does not seem to drain the battery. Other apps like Moves which seems to record number of steps pretty accurately declares that it uses a lot of power because of it constantly monitoring the GPS and the accelerometer. I imagine several possibilities: Wakes up the phone every minute or so, then analyses the sensors for a few seconds and

Android: Is there a way to obtain altitude aside from Location.getAltitude()? (I've heard using Sensor)

十年热恋 提交于 2019-12-18 07:10:39
问题 Is there a way to obtain altitude aside from Location.getAltitude()? I've heard using Sensor but don't have idea and can't find on net. UPDATES1 I found SensorManager.getAltitude(float, float) using API Level 9 up but don't have idea on how to implement it. Would you share with us. 回答1: I know it's late but for anyone looking for it, that might help import android.app.Activity; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener;

Get Device Moving Direction without GPS

匆匆过客 提交于 2019-12-18 05:23:33
问题 With Which Sensor I Can Detect when device is moving to a direction In Absolute Coordinate(for example moving to +x or -x). I need accurate data,so i cannot use GPS . the Complete Task is to plot in paint(in computer) with android device sensors and this part of task in unknown for me. 回答1: I'm a little confused about what you're asking. Do you want to put a device in your pocket and walk around, and make a plot of everywhere you walked? Or do you want to wave the device around in your hand

Vintage Thermometer component + SensorSimulator on the Android emulator

纵饮孤独 提交于 2019-12-18 05:22:25
问题 After I found this nice custom component that analogly (is this the right word?) displays the temperature read from the Android device's temperature sensor, I wanted to test it with the emulator to see how it works so I've found this Sensor Simulator and altered the component's source to work with it. I did manage it to work on en emulated device, however I've done a few lucky guesses and'd like to know what exactly I've done :-) Here are the changes in thermometer's code I had to make to get

Android: get device orientation from Azimuth, roll & pitch

雨燕双飞 提交于 2019-12-17 22:33:06
问题 I need to get the updated device orientation, but I have to fix my activity to Portrait (which I did in the layout xml file), which prevents me from using this: int rotation = getWindowManager().getDefaultDisplay().getRotation(); because it always gives me the portrait rotation, So, I'm trying to rely on the sensors. I found that Sensor.TYPE_ORIENTATION is deprecated, so I'm using a combination of Sensor.TYPE_ACCELEROMETER & Sensor.TYPE_MAGNETIC_FIELD and here is the event listener:

Android 4.3: BLE: Filtering behaviour of startLeScan()

爷,独闯天下 提交于 2019-12-17 08:33:05
问题 I'm working on a BluetoothLE sensor device, for which I need to form a one-to-many broadcast of data. As per the spec, peripherals may only have a single master, and due to limitations of the chip and stack I'm designing on, a master can only have three slaves. From what I understand, Android cannot become a BLE slave anyway, so having my device as a master is not an option. Both the BT4 spec and manufacturer documentation talk about another mode of operation, referred to as Broadcast mode.

How to use Android sensors to detect how fast the device is moving

萝らか妹 提交于 2019-12-14 03:44:47
问题 I am a beginner at android programming and I have come up with some progress on getting the sensor data (Source code below). Can someone help me with detecting how fast my Android device is moving using these information? For example if I am moving the device fast, it will give me like 10, and if I am moving it slowly, I will get like 1. Aside from accelerometer, all other sensors are also OK for me. package course.examples.Sensors.ShowValues; import android.app.Activity; import android

Android - user-defined delay is used in registerListener(). Not working, why?

荒凉一梦 提交于 2019-12-14 02:20:11
问题 I am trying to read the values from the android phone sensors. I initialize the sensors as follows: private void sensorInit() { sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE); sensorManager.registerListener(this, sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_FASTEST); sensorManager.registerListener(this, sensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE), SensorManager.SENSOR_DELAY_FASTEST); sensorManager.registerListener(this,

Updating TextView without losing Spinner focus in busy ListView

瘦欲@ 提交于 2019-12-13 12:21:34
问题 I sample sensors (That's make the ListView busy) with custom user rate and I show the values in my listview, therefore I have a custom listview with 3 textview (for x, y and z values) and one spinner. my layout is: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="fill_parent"> <LinearLayout android:orientation="vertical" android:layout

Android Shake(Sensor) Service For shake Detection in Application Background

五迷三道 提交于 2019-12-13 12:11:08
问题 I have develop an Application that have shaking functionality for some function to work so i have use shaking class and implement to Main Activity so its work smoothly while Application running but my question is when my application going to sleep or kill or stop then how to detect shake in background (Service) My shacking class public class Shaker implements SensorListener { private static final int FORCE_THRESHOLD = 350; private static final int TIME_THRESHOLD = 200; private static final