Sorry, that's my fault. It doesn't work and the addEventListener will add multiple times.

I had verified that it doesn't send the devicemotion events when camera is not the active app. I use console.log to print something. It stops when I go back to homescreen.