Accelerometer support

Hi OpenFL team.

I’m on a projet which requires the use of the Accelerometer.
I’m using the latest official releases (3.4.1 for Lime, 4.4.1 for Openfl).

From what I’m experimenting, it does work on android devices but not on iOS.
Is that a known fact ?
Was it implemented/fixed in the development branches?

Otherwise, do you have any inputs on how/where should I have a look ?

Thanks !
Thomas

I’ve been digging a bit more about that.
It seems to be an SDL2 issue.
From what I understood, the hacky stuff they did to support accelerometer through Joystick device (hum) is using a deprecated Apple API UIAccelerometerDelegate

I’m going to have a look on how to fix this on SDL side (if not already fixed), otherwise I think I’ll go for a native extension…

We just updated to a recent dev version of SDL2, if it was patched since the last formal release, we may have the fixes in on GIT

Ok I’ll do that this morning and let you know.

@singmajesty Humm I’ve no luck so far.
Reading the SDL code, it seems to be updated and using CoreMotion. I’ll add some logs in there.

But I may have done something wrong rebuilding the environnement.
How can I be sure to be running the latest version of lime with correct sdl version?
I’ve built the development branch, and I’ve moved to latest hxcpp.
I also had to add the flag -Dopenfl_dynamic for the swf lib.

Is there anything else I should consider to be using correctly the development versions?

  • run haxelib -list to be sure this is the lib version you want to use (the lime git one in your case) that are set as default into haxelib
  • delete the ios folder into the Export of your project to be sure you recompile everything from scratch

Hello Thomas.
Thanks for the inputs, but, yes, both are done and checked already. It’s just that git lime doesn’t seems to have an incremented version number (Lime Command-Line Tools (3.4.1) on my dev)

No it doesn’t. But if this is the git version that is set for lime into haxelib and if you perform an haxelib upgrade, it would checkout the latest version from the git repository and ask you if you want to update if you don’t already have it up to date in your local repository.
You can also perform a manual checkout yourself with the git command line tool if you prefer

You may need to git submodule init && git submodule update on your version of Lime, then lime rebuild ios -clean to be sure that you have a clean build of the latest SDL :slight_smile:

Ok, I was doing all of this, so the env was correct.
The reason I asked was because I added some printf and didn’t see any of these in the xcode output console.
I forgot to rebuild the binaries (hxcpp included) in debug mode.

Since, I’ve spend many many hours to track down, SDL side, how it was done. I was thinking about an iOS api upgrade issue, but it was not.
The problem was in fact pretty simple: a defined mistake. This is a ridiculously hard thing to debug… no way to think there’s an error in those. (was working on Android, so I though the code block was correctly running)

But the fix is right here : https://github.com/openfl/lime/pull/851 :slight_smile:

1 Like