Motion Detection Use

by burrkie » Mon, 12 Oct 2009 21:49:25 GMT


Sponsored Links
 Hi,

I was wondering if anybody knew if it is possible to track the speed
the phone is moving using the motion sensors. I've researched a bit
into how to calculate data from it but I was wondering if it is
possible to check say how fast the person holding the phone is moving,
and if they speed up or slow down?

or can it be used to determine the direction the phone is moving? I no
gps can do this but for the project I have in mind it would need to be
alot more accurate.
--~--~---------~--~----~------------~-------~--~----~



Motion Detection Use

by Mark Murphy » Mon, 12 Oct 2009 22:07:54 GMT


 


The "motion sensors" sense *acceleration*, not movement.


For any significant distance (e.g., 50 meters or more), I suspect GPS
will likely be more accurate than the accelerometer and the compass.

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

Android App Developer Books:  http://commonsware.com/books.html 

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Other Threads

1. Audio Source Input for MIC Recording

I found there is a mismatch of define constant in these 2 files for
the source input: AudioRecord.h and MediaRecorder.java

In native code (AudioRecord.h), the values are...
44     enum input_source {
45         DEFAULT_INPUT   =-1,
46         MIC_INPUT       = 0,
47         VOICE_UPLINK_INPUT = 1,
48         VOICE_DOWNLINK_INPUT = 2,
49         VOICE_CALL_INPUT = 3,
50         NUM_INPUT_SOURCES
51     };
http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=include/media/AudioRecord.h;h=13e51eea1eb478517f677df0642b4d2221571192;hb=donut#l38


In Java MediaRecorder AudioSource, the values are...
120     public final class AudioSource {
121       /* Do not change these values without updating their
counterparts
122        * in include/media/mediarecorder.h!
123        */
124         private AudioSource() {}
125         public static final int DEFAULT = 0;
126         /** Microphone audio source */
127         public static final int MIC = 1;
128
129         /** Voice call uplink (Tx) audio source */
130         public static final int VOICE_UPLINK = 2;
131
132         /** Voice call downlink (Rx) audio source */
133         public static final int VOICE_DOWNLINK = 3;
134
135         /** Voice call uplink + downlink audio source */
136         public static final int VOICE_CALL = 4;
137     }
http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=media/java/android/media/MediaRecorder.java;h=be4b489eb08683750fc2149184ab073e8528e6d4;hb=donut#l120


I found a similar thread with this issue too:
http://groups.google.com.tw/group/android-developers/browse_thread/thread/01b53ce66b43810c/a578913b17a6bcca?#a578913b17a6bcca

I need to refer to the define AudioRecord::MIC_INPUT at the source
AudioHardwareALSA.cpp to determine which is the input source and set
the audio route accordingly for MIC recording, but this will cause a
wrong route because of this mismatch of constant define at the 2
source files.

Is it a bug by the Google?

Thanks

2. Ringtone from the RingtoneManager always returns null

Hey all,

I have this piece of code to enumerate the ringtones on the system:

                RingtoneManager rm = new RingtoneManager(this);
                Cursor c = rm.getCursor();

                c.moveToFirst();
                while(!c.isAfterLast()){

                        Uri geller = rm.getRingtoneUri(c.getPosition());
                        Log.d(TAG,"path: "+geller);
                        Ringtone rt = RingtoneManager.getRingtone(this, geller);
                        Log.d(TAG,"rt: "+rt);

                        Log.d(TAG, "Ringtone: 
"+rm.getRingtone(c.getPosition()));
                        c.moveToNext();
                }
                c.deactivate();

But the RingtoneManager always returns null. Here's some log-output:

01-15 13:48:51.414: DEBUG/CallReceiverActivity(315): path:
content://media/internal/audio/media/1
01-15 13:48:51.503: DEBUG/MediaPlayer(315): Couldn't open file on
client side, trying server side
01-15 13:48:51.613: ERROR/MediaPlayerService(31): Couldn't open fd for
content://media/internal/audio/media/1
01-15 13:48:51.613: ERROR/MediaPlayer(315): Unable to to create media
player
01-15 13:48:51.623: ERROR/RingtoneManager(315): Failed to open
ringtone content://media/internal/audio/media/1
01-15 13:48:51.623: DEBUG/CallReceiverActivity(315): rt: null
01-15 13:48:51.764: DEBUG/MediaPlayer(315): Couldn't open file on
client side, trying server side
01-15 13:48:51.834: ERROR/MediaPlayerService(31): Couldn't open fd for
content://media/internal/audio/media/1
01-15 13:48:51.845: ERROR/MediaPlayer(315): Unable to to create media
player
01-15 13:48:51.845: ERROR/RingtoneManager(315): Failed to open
ringtone content://media/internal/audio/media/1
01-15 13:48:51.845: DEBUG/CallReceiverActivity(315): Ringtone: null

As you can see, the MediaPlayer is unable to open the file. Should I
have extra permissions? Is anything else preventing me from accessing
the file? Would appreciate help :)

Regards,

Daan

3. Extending contacts

4. How to get device details

5. AvoidXferMode

6. Showing the map view before the direction list on android device.

7. play video bypass surfaceflinger