leecrossley / cordova-plugin-shake

Cordova / PhoneGap Plugin to detect when a physical device performs a shake gesture
http://ilee.co.uk
92 stars 33 forks source link

onShake() not working on Android 12 #39

Open CheeseMistress opened 2 years ago

CheeseMistress commented 2 years ago

Tested my code on Nexus 6P running on Android 8.x.x, and shake triggers perfectly. On my Google Pixel 3XL running on Android 12, onShake event is not triggered. Shake functionality is verified to be working on the Pixel (tested through another app).

`var shakeNode;

document.addEventListener("deviceready", onDeviceReady, false);

function onDeviceReady() { shakeNode = document.getElementById('shakeId'); if (typeof shake !== 'undefined') { shakeNode.innerHTML = "ready!" shake.startWatch(onShake, 30, onShakeError); } }

var onShake = function() { alert("Shake triggered."); }

var onShakeError = function () { alert("ShakeError occurred.") }`

monkeywithoutthee commented 2 years ago

does it give any errors?

markalston commented 1 month ago

@CheeseMistress Did you ever get this solved? I am able to get it working on Android 12 but not on Android 14. No errors or messages of any kind. I think it is due to using the device-motion plugin which is depreciated.