Home Features Docs Blog Support GitHub

MOE on Iphone7 Not reading accelerometer info


(Ian Hunter) #1

I inserted the following lines into my core modules code:
boolean available = Gdx.input.isPeripheralAvailable(Input.Peripheral.Accelerometer);
System.out.println("Is Accelerometer available: "+available);

Output:
Is Accelerometer available: false

When I ported my video game over to iOS, the accelerometer stopped working and couldn’t be found.

Does anyone have a fix for this bug?
Do I need to configure the build.gradle in moe to enable accelerometer input?


(Ian Hunter) #2

Fixed the error by changing the accelerometer config settings in the MOE Launcher
public class IOSMoeLauncher extends IOSApplication.Delegate {

protected IOSMoeLauncher(Pointer peer) {
    super(peer);
}

@Override
protected IOSApplication createApplication() {
    IOSApplicationConfiguration config = new IOSApplicationConfiguration();
    config.useAccelerometer = true;
    return new IOSApplication(new DeegGame(), config);
}

public static void main(String[] argv) {
    UIKit.UIApplicationMain(0, null, null, IOSMoeLauncher.class.getName());
}

}