BASIC

Author Topic: Android accelerometer issue in beta 11.  (Read 2605 times)

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 3611
    • View Profile
    • Space Fractal
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).
Greedy Mouse - Karma Miwa - Spot Race - CatchOut - Android Extras - is on a vacation trip, home before end of few days in jan.

Offline caffeinekid

  • Mr. Drawsprite
  • **
  • Posts: 53
    • View Profile
    • TCKSOFT
Re: Android accelerometer issue in beta 11.
« Reply #1 on: 2013-Jan-05 »
Is there any update on this please? :bed:

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10697
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Android accelerometer issue in beta 11.
« Reply #2 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.

Offline BdR

  • Dr. Type
  • ****
  • Posts: 303
    • View Profile
    • BdR Games
Re: Android accelerometer issue in beta 11.
« Reply #3 on: 2013-Feb-26 »
I downloaded GLBasic v11.322 and the GETJOY commands now work correctly again on Android :good: sweet

Offline sf-in-sf

  • Mr. Drawsprite
  • **
  • Posts: 93
  • Artist F.P. Brixey
    • View Profile
    • My computed art project
Re: Android accelerometer issue in beta 11.
« Reply #4 on: 2013-Apr-15 »

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)
On the day the atom is a cube I will start believing in the square pixel.

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4185
    • View Profile
    • Portfolio
Re: Android accelerometer issue in beta 11.
« Reply #5 on: 2013-Apr-15 »
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 :)