Typically to know whether the device is moving or not, you could use  the 
SensorEventListener 
and catch the onSensorChanged event and write a logic on the x,y and z 
values to see if the device is moving ( from the accelerometer ) , or you 
can use the LocationManager with the source as GPS and locationListener to 
catch the onLocationChanged event. In both the cases, you can then make use 
of JNI and implement your algo in C/C++ and interface it with your java 
code via JNI.

Depending on your needs, if you simply need to know if the device is in 
motion, i would suggest you use the accelerometer rather than GPS, as GPS 
would take time to get a fix and also wont work indoors.

On Tuesday, April 1, 2014 11:37:52 AM UTC-4, Uday Gupta wrote:
>
> Hi Glenn,
>
> Primarily want to know if the device is moving or not. So probably have to 
> get info from accelerometer or GPS.
>
> What I am looking for is how to access this information from Audio HAL.
>
> Thanks
>
> On Thursday, March 27, 2014 10:05:32 PM UTC-7, Glenn Kasten wrote:
>>
>> I'm not sure what kind of sensors you need to  get information from, but
>> there's an example of monitoring device orientation and rotation in  
>>
>> frameworks/base/media/java/android/media/AudioService.java.
>> Search for mMonitorOrientation and mMonitorRotation.
>> On Wednesday, March 26, 2014 8:07:09 PM UTC-7, Uday Gupta wrote:
>>>
>>> Hi,
>>>
>>> I am working on some audio algorithm in audio HAL. This audio algorithm 
>>> needs to get the information from the sensors. What would be the best way 
>>> to get this information?
>>>
>>> 1. Directly call the kernel sensor interface.
>>> 2. Use the sensor service.
>>>
>>> Thanks
>>>
>>

-- 
-- 
unsubscribe: [email protected]
website: http://groups.google.com/group/android-porting

--- 
You received this message because you are subscribed to the Google Groups 
"android-porting" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to