I would like to create an android app that makes the user play games requiring to tilt the screen with key inputs. Is it possible to simulate accelerometer data when some key is pressed? In the meantime, can I disable with some code the real accelerometer when my app is running?
EDIT: I forgot to mention that I have access to the full android source, plus kernel source, so I could even add specific code or create some java code to disable or "fake" the source of accelerometer inputs.
By following this tutorial, you can disable Accelerometer easily.
Note the lines
package com.badlogic.drop;
import android.os.Bundle;
import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
public class AndroidLauncher extends AndroidApplication {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AndroidApplicationConfiguration config= new AndroidApplicationConfiguration();
config.useAccelerometer = false;
config.useCompass = false;
initialize(new Drop(), config);
}
}
Thee tutorial in the link is for libgdx and libgdx is a Java game development framework that provides a unified API that works across all supported platforms including android.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With