I've written a JS SDK for Android WebView that collects device orientation and motion. The SDK listens to deviceorientation
and devicemotion
events on the window like so:
window.addEventListener('devicemotion', (event) => {...})
window.addEventListener('deviceorientation', (event) => {...})
On some devices/integrations, I get no sensors data. I've tried to mimic a "bad" integration, attempting to block the WebView sensors access by adding the following to the app manifest but with no luck. The JS events are still triggered:
<activity
android:screenOrientation="portrait"
android:configChanges="keyboardHidden|orientation|screenSize"
What are other possible ways to block the WebView from triggering the events, besides disabling JS all together?
Update:
Some insights:
the most problematic devices are:
- Samsung Galaxy Tab a 10.1 SM-T580
- Samsung Galaxy J5 Prime SM-G570M
Update 2
I have similar issues on IOS on some devices, most problematic is:
- Mozilla/5.0 (iPhone; CPU iPhone OS 12_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148