GLBasic forum

Main forum => Bug Reports => Topic started by: spacefractal on 2012-Dec-26

Title: Android accelerometer issue in beta 11.
Post by: spacefractal on 2012-Dec-26
Quote from: BdR on 2012-Dec-21
I'm testing on Android again, and two things I've noticed

Firstly, my app uses PLATFORMINFO$("DOCUMENTS") to store the settings and saved game. Now I was testing on an Android device without a SD card and then the game was not saved. So, I changed it to PLATFORMINFO$("APPDATA") for Android just to be sure, so like this:
Code (glbasic) Select
CONSTANT SETTINGS_FILE$ = "/snakeslider.ini"
//INIOPEN PLATFORMINFO$("DOCUMENTS") + SETTINGS_FILE$
INIOPEN PLATFORMINFO$("APPDATA") + SETTINGS_FILE$


Second, the GETJOYX(0), GETJOYY(0), GETJOYZ(0) functions don't seem to work for Android. When compiling with v10 for Android, it gave the accelerometer values but now in v11 it seems to give just 0. Only GETJOYZ(0) sometimes jumps from 0 to -1 when I shake the device. The GETJOYNAME$(0) still gives "Android accelerometer" though..

I can as I wrote in the beta 11 thread, confirm this bug.

The java part code works fine. If I multiply with 10 in onSensorChanged() in SDLActicvity.java, then I got returned a nice integer values between -10 and 10. But If I multiply more, then its seen its have limited to 10 for some reasons. so its a bug in the onNativeAccel() c++ function. Its cleary its have been converted to integer, which its should not....

This bug can been workaround by using the java communication code I wrote in the code snippets forum and then gets its floats that way. I look on that later, or by multiply with 10 (which give some control, but not fine control over it).
Title: Re: Android accelerometer issue in beta 11.
Post by: caffeinekid on 2013-Jan-05
Is there any update on this please? :bed:
Title: Android accelerometer issue in beta 11.
Post by: Kitty Hello on 2013-Jan-06
Yes... And no... I fixed this, but the multitasking is still buggy. So I used the new SDL2.0 port. Which works now. But I need a sdl-mixer lib now. I hope to fix it pretty soon.
Title: Re: Android accelerometer issue in beta 11.
Post by: BdR on 2013-Feb-26
I downloaded GLBasic v11.322 and the GETJOY commands now work correctly again on Android :good: sweet
Title: Re: Android accelerometer issue in beta 11.
Post by: sf-in-sf on 2013-Apr-15
Quote from: spacefractal on 2012-Dec-26

Second, the GETJOYX(0), GETJOYY(0), GETJOYZ(0) functions don't seem to work for Android.
They do work for me and I used them a lot. Android 4.0 archos G9 10.1 tablet,  IDE v. 10.244. I get some strange values -0.917 to +0.917 after calibrating the tablet repeatedly, instead of 1.0
What you describe looks like you assign an int variable to the GETJOY... Fn. Try once:
Code (glbasic) Select
static jx# // float or so.
jx = GETJOYX(0)

Title: Re: Android accelerometer issue in beta 11.
Post by: erico on 2013-Apr-15
Quote from: BdR on 2013-Feb-26
I downloaded GLBasic v11.322 and the GETJOY commands now work correctly again on Android :good: sweet

GReat, I was using v10, which it works, and the one v11 before the last one, which it didnĀ“t.
Time to update the beta :)