How to access accelerometer on Android

General topics about the Android-Platform itself.
Coding issues please to the subforum right below.

How to access accelerometer on Android

Postby nit1507 » Wed Jan 09, 2008 4:32 pm

How to access accelerometer on android ? and Is it possible to emulate acceleration using emulator ? Can you show any sample ?

Thanks in advance
User avatar
nit1507
Freshman
Freshman
 
Posts: 6
Joined: Wed Jan 09, 2008 4:27 pm
Location: Chennai, India

Top

Postby plusminus » Fri Jan 11, 2008 8:29 pm

Hello nit1507,

currently it is not possible to emulate the Accelerometer.
But I created some :src: sample-code (click), that will work (ok without testing I cannot ensure that, but it should ;) ).

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Accessing Accelerometer.

Postby nit1507 » Sat Jan 12, 2008 5:02 am

Hello plusminus,
Thank for the reply and sample code . It has solved my problem.
User avatar
nit1507
Freshman
Freshman
 
Posts: 6
Joined: Wed Jan 09, 2008 4:27 pm
Location: Chennai, India

error

Postby mohamed.adel » Mon Feb 16, 2009 9:28 am

i am new in android and i want to use the ACCELEROMETER in my application

but i have an error that in line

import android.hardware.Sensors;

as android.hardware.Sensors; is not resolved

so any one can help

thanks in advance
Mohamed Adel
mohamed.adel
Freshman
Freshman
 
Posts: 9
Joined: Mon Feb 16, 2009 9:14 am

Postby mortefer » Mon Feb 16, 2009 12:30 pm

that's true, such class doesn't exist. but if you dig a bit deeper you can find out that the only stuff u need is:

import android.hardware.SensorListener;
import android.hardware.SensorManager;
mortefer
Experienced Developer
Experienced Developer
 
Posts: 54
Joined: Sat Dec 20, 2008 11:24 am

Postby mohamed.adel » Mon Feb 16, 2009 1:26 pm

thanks alot

but I still have an error so I think the problem in the android version or in SDK version
mohamed.adel
Freshman
Freshman
 
Posts: 9
Joined: Mon Feb 16, 2009 9:14 am

Top

Re: error

Postby sarangkulkarni17 » Mon Feb 23, 2009 8:42 am

mohamed.adel wrote:i am new in android and i want to use the ACCELEROMETER in my application

but i have an error that in line

import android.hardware.Sensors;

as android.hardware.Sensors; is not resolved

so any one can help

thanks in advance
Mohamed Adel


hello mohamed.adel,
may this one help you out!!

import org.openintents.hardware.Sensors;

& add external jar ->> openintents-lib.jar into your's project library
http://code.google.com/p/openintents/wi ... rSimulator
sarangkulkarni17
Developer
Developer
 
Posts: 29
Joined: Fri Feb 13, 2009 10:00 am
Location: Pune

Postby mohamed.adel » Mon Feb 23, 2009 4:07 pm

Thanks alot sarangkulkarni17 :)
mohamed.adel
Freshman
Freshman
 
Posts: 9
Joined: Mon Feb 16, 2009 9:14 am

Postby mohamed.adel » Tue Feb 24, 2009 6:13 pm

Hi all,

I want to get speed by ACCELEROMETER, I tried alot of codes but they do not work well

so any one can help
mohamed.adel
Freshman
Freshman
 
Posts: 9
Joined: Mon Feb 16, 2009 9:14 am

Top

Return to General

Who is online

Users browsing this forum: No registered users and 3 guests