songzy12 / AndroidRotationSensor

0 stars 0 forks source link

Design #1

Closed songzy12 closed 2 years ago

songzy12 commented 2 years ago

Milestones:

  1. Decide API version
  2. Get sensor realtime values
  3. Show UI based on values
songzy12 commented 2 years ago

So what is the Android version for Harmony 2.0?

https://arstechnica.com/gadgets/2021/06/huaweis-harmonyos-will-rollout-to-100-android-models-over-the-next-year/ At least Android 11?

songzy12 commented 2 years ago

https://developer.android.com/guide/topics/sensors/sensors_overview

songzy12 commented 2 years ago

Should be this one?

[x] https://developer.android.com/guide/topics/sensors/sensors_position#sensors-pos-orient [o] https://developer.android.com/guide/topics/sensors/sensors_motion#sensors-motion-rotate

songzy12 commented 2 years ago
        private final float[] mRotationMatrix = new float[16];
public void onSensorChanged(SensorEvent event) {
    if (event.sensor.getType() == Sensor.TYPE_ROTATION_VECTOR) {
                SensorManager.getRotationMatrixFromVector(
                        mRotationMatrix, event.values);
            gl.glMultMatrixf(mRotationMatrix, 0);
songzy12 commented 2 years ago

https://developer.android.com/reference/android/hardware/SensorManager#getRotationMatrixFromVector(float[],%20float[])

songzy12 commented 2 years ago

https://developer.android.com/training/graphics/opengl