Opt-out from accelerometer input (DEF-1396) (SOLVED)

If a mobile game don’t use accelerometer, can we opt-out from receiving accelerometer events in on_input?

1 Like

Are you asking this because of a worry about performance or some other reason?

Performance and battery life.
In Unity, for example, manual says:
"If accelerometer input is processed too frequently then the overall performance of your game may suffer as a result. By default, a Unity iOS application will sample the accelerometer 60 times per second. You may see some performance benefit by reducing the accelerometer sampling frequency and it can even be set to zero for games that don’t use accelerometer input."
In Defold we can’t do anything.

1 Like

Hmm, yes, I remember that we had a discussion regarding the accelerometer and battery life a while back here at the office. I don’t think it ever ended up in a JIRA issue. @Ragnar_Svensson or someone else working right now, could you please check?

1 Like

I found the JIRA ticket DEF-1396. No scheduled ETA unfortunately, but it’s good you call this out, it makes it easier to prioritize.

4 Likes

The year has passed…

1 Like

Not good. When opting out would it be in game.project or at runtime?

Runtime. Developers should explicitly start/stop motion data updates.
It’s probably complex topic, and while it is not ready, having simple checkbox (to opt-out from any device-motion data updates) in project is a good thing.

Probably a good idea to remove it from the core and make it an extension.

It could be an argument to the acquire_input_focus message maybe?

1 Like

Fixed in Defold 1.2.116 (input.use_accelerometer in game.project)

3 Likes