Merge pull request #17998 from xsellier/bugfix-17988/set_accelerometer-android

Initialize sensors to default values for Android platform
This commit is contained in:
Rémi Verschelde 2018-04-05 18:30:53 +02:00 committed by GitHub
commit ac68513a97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -379,6 +379,13 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
mGyroscope = mSensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE);
mSensorManager.registerListener(this, mGyroscope, SensorManager.SENSOR_DELAY_GAME);
// Since there is no way to poll sensors themselves to get actual values
// we initialize them to 0
GodotLib.accelerometer(0, 0, 0);
GodotLib.gravity(0, 0, 0);
GodotLib.magnetometer(0, 0, 0);
GodotLib.gyroscope(0, 0, 0);
result_callback = null;
mPaymentsManager = PaymentsManager.createManager(this).initService();