Do any versions of androids web browser detect javascript shake events? Something like this:
window.addEventListener('devicemotion', this, false);
I can't seem to find any information on this.
I am using WKShake which is refrenced here: Javascript. Listen for iPhone shake event?
and am wondering if this is going to work on android as well.
            Asked
            
        
        
            Active
            
        
            Viewed 3,139 times
        
    2
            
            
        - 
                    See http://stackoverflow.com/questions/4112369/how-to-shake-on-android-2-2 – josh.trow Apr 29 '11 at 15:50
 - 
                    1@josh, that looks like android code to me. I asked about javascript. – pizza247 Apr 29 '11 at 15:51
 
3 Answers
3
            After some research, I have discovered that the android browser does not have access to accelerometer data. Perhaps some time in the future they will allow the browser to access this data.
        pizza247
        
- 3,869
 - 7
 - 33
 - 47
 
1
            
            
        Shake.js (http://functionn.blogspot.com/2012/03/shakejs-custom-shake-event-javascript.html) is a custom 'shake' event JavaScript plugin for mobile web browsers using device accelerometer. Your web browser must support the devicemotion event for this plugin to work. Shake.js uses built-in feature detection to determine if it can run in your web browser. It will terminate silently on non-supporting browsers.
        Hirvesh
        
- 7,636
 - 15
 - 59
 - 72
 
0
            
            
        Here's an implementation of a JavaScript shake method for Android built on top of PhoneGap's accelerometer API - github link
        Paul Beusterien
        
- 27,542
 - 6
 - 83
 - 139
 
- 
                    this is closer to what I'm after, but again, I'm wanting to see this work in the browser, not a phone gap native applicaiton. – pizza247 May 02 '11 at 14:48
 - 
                    @jtmkrueger As your answer says, the browser doesn't have direct access to the accelerometer, as well as a bunch of other device capabilities. That is the "Gap" that PhoneGap is designed to fill. – Paul Beusterien May 02 '11 at 15:52