android gyroscope

Previous topic - Next topic

RattlerCreed

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.

kanonet

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.
Lenovo Thinkpad T430u: Intel i5-3317U, 8GB DDR3, NVidia GeForce 620M, Micron RealSSD C400 @Win7 x64

RattlerCreed

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?

kanonet

Hmm strange. Maybe try again, maybe even with a new project? Sorry cant really help, since compiling is working fine for me.
Lenovo Thinkpad T430u: Intel i5-3317U, 8GB DDR3, NVidia GeForce 620M, Micron RealSSD C400 @Win7 x64

RattlerCreed

I've tried it again still the same uninstalled and re-installed but same problem. Does it matter what version of java you have?

kanonet

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?
Lenovo Thinkpad T430u: Intel i5-3317U, 8GB DDR3, NVidia GeForce 620M, Micron RealSSD C400 @Win7 x64

RattlerCreed

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

spacefractal

Have you tried to remove the android projekt? Is Sound like a manifest.xml error
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

RattlerCreed

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.

spacefractal

#9
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.

Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

RattlerCreed

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.

erico

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.