also looking at this
feat(android): the motion pair, and org.json's numbers — ratchet 54 → 52
#187
7 files
+577
-3
| @@ -2866,6 +2866,11 @@ class CraftBridge( | ||
| 2866 | 2866 | |
| 2867 | 2867 | @JavascriptInterface |
| 2868 | 2868 | fun startMotionUpdates(intervalMs: Int): Boolean { |
| 2869 | // The SensorEventListener object is CraftNative's, and so is the | |
| 2870 | // last-value bookkeeping — which is why stopMotionUpdates has to reach | |
| 2871 | // the same way, or its own fields stay null and nothing unregisters. | |
| 2872 | if (CraftNative.startMotionUpdates(activity, intervalMs)) return true | |
| 2873 | ||
| 2869 | 2874 | sensorManager = activity.getSystemService(Context.SENSOR_SERVICE) as SensorManager |
| 2870 | 2875 | accelerometer = sensorManager?.getDefaultSensor(Sensor.TYPE_ACCELEROMETER) |
| 2871 | 2876 | gyroscope = sensorManager?.getDefaultSensor(Sensor.TYPE_GYROSCOPE) |
| @@ -2907,6 +2912,8 @@ class CraftBridge( | ||
| 2907 | 2912 | |
| 2908 | 2913 | @JavascriptInterface |
| 2909 | 2914 | fun stopMotionUpdates() { |
| 2915 | if (CraftNative.stopMotionUpdates(activity)) return | |
| 2916 | ||
| 2910 | 2917 | sensorListener?.let { sensorManager?.unregisterListener(it) } |
| 2911 | 2918 | sensorListener = null |
| 2912 | 2919 | } |