GLBasic forum

Main forum => GLBasic - en => Topic started by: RattlerCreed on 2013-Nov-01

Title: android gyroscope
Post by: RattlerCreed on 2013-Nov-01
Hi All

Is there anyway I can access the gyroscope sensor on a android device?

Ok I've tried use GETJOYRX() ,GETJOYRY() ,GETJOYRZ() thinking that would have some effect but they don't even change value.
Title: Re: android gyroscope
Post by: kanonet on 2013-Nov-01
Normally the JOY... commands are what you need for this. Which version of GLB do you use V10? I think there was a bug about accelerator that got fixed in V11/V12.
Title: Re: android gyroscope
Post by: RattlerCreed on 2013-Nov-01
Yeah I've just updated to V12 now I'm getting this when i try n compile for android?

Code (glbasic) Select

BUILD FAILED
C:\Program Files (x86)\GLBasic_v12\Compiler\platform\android\android-sdk-windows\tools\ant\build.xml:539: The following error occurred while executing this line:
C:\Program Files (x86)\GLBasic_v12\Compiler\platform\android\android-sdk-windows\tools\ant\build.xml:568: null returned: 1


Any ideas?
Title: Re: android gyroscope
Post by: kanonet on 2013-Nov-01
Hmm strange. Maybe try again, maybe even with a new project? Sorry cant really help, since compiling is working fine for me.
Title: Re: android gyroscope
Post by: RattlerCreed on 2013-Nov-01
I've tried it again still the same uninstalled and re-installed but same problem. Does it matter what version of java you have?
Title: Re: android gyroscope
Post by: kanonet on 2013-Nov-02
Im not sure. Im using JDK 1.7.0.250 (no specific reason why this, was just to lazy to upgrade), and it works fine. Maybe you need to wait for someone else to come up and help you. In the mean time it could be a good idea to give us the full compile log, just in case.
BTW did you also try to create a new GLB project, not staying on your old one?
Title: Re: android gyroscope
Post by: RattlerCreed on 2013-Nov-02
Its fixed now did as you said and created a new project and seemed to work Thanks For all the help kanonet.  :nw: very strange. :S
Title: Re: android gyroscope
Post by: spacefractal on 2013-Nov-02
Have you tried to remove the android projekt? Is Sound like a manifest.xml error
Title: Re: android gyroscope
Post by: RattlerCreed on 2013-Nov-02
Quote from: spacefractal on 2013-Nov-02
Have you tried to remove the android projekt? Is Sound like a manifest.xml error

Yeah it must of been that as i created a new project and works fine. Gyroscope still not working tho.
Title: Re: android gyroscope
Post by: spacefractal on 2013-Nov-02
EDIT: removed the later post and joined to this one, sorry.

Property, only the accelerator sensors is supported, which means you need some java calls to access other kinds of sensors.

The major issue is glbasic can only supports one kind of sensors from java, which is due to this function in SDLActivity.java (there is no id argument):
public static native void onNativeAccel(float x, float y, float z);

That mean to access the gyroscope, you need add them and doing new java calls to checks those values, due you cant send them back to the nativeaccel function. But instead you need to checkout the sensors values trought javacalls.

Title: Re: android gyroscope
Post by: RattlerCreed on 2013-Nov-03
Quote from: spacefractal on 2013-Nov-02
EDIT: removed the later post and joined to this one, sorry.

Property, only the accelerator sensors is supported, which means you need some java calls to access other kinds of sensors.

The major issue is glbasic can only supports one kind of sensors from java, which is due to this function in SDLActivity.java (there is no id argument):
public static native void onNativeAccel(float x, float y, float z);

That mean to access the gyroscope, you need add them and doing new java calls to checks those values, due you cant send them back to the nativeaccel function. But instead you need to checkout the sensors values trought javacalls.



Cheers for the information how ever I've never programmed in Java so I wouldn't have clue whereto start.
Title: Re: android gyroscope
Post by: erico on 2013-Nov-04
Android G-sensor was out during betas for some time. There can be a possibility that they now work with different values.
In my case, an older glb version worked, the newers seemed to work with different parameters, but I haven“t tried the latest version.