Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

140
Vistas
detect shake event on iphone

I'm trying to detect a shake event on iPhone. shake.js library is not working, would appreciate any help or other solutions. I've also tried this but no luck.

function ClickRequestDeviceMotionEvent () {
window.DeviceMotionEvent.requestPermission()
.then(response => {
  if (response === 'granted') {
    window.addEventListener('devicemotion',
      () => { 
          //alert('DeviceMotion permissions granted.'); 
          
          var o = 0.6; // 0
          var myShakeEvent = new Shake ({
            threshold: 10, // 15. optional shake strength threshold
            timeout: 1000 // optional, determines the frequency of event generation
          });
          
          myShakeEvent.start(); // mobile, no ipad

          window.addEventListener('shake', shakeEventDidOccur, false);
          
          function shakeEventDidOccur() { // function to call when shake occurs
            alert('shake!');
          } 
      },
      (e) => { throw e }
  )} else {
    alert('DeviceMotion permissions not granted.')
  }
})
.catch(e => {
  alert(e)
})

}

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

By the looks of it, this isn't possible anymore.

Shake.js was discontinued so is not supported.

Also, Safari does not support the Accelerometer, Gyroscope or the DeviceMotionEvent web API's, so this data is just not available for your code to react to.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda