• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps onSensorChange to only run once

Nismon8er

Lurker
Hello,

I have been searching everywhere but no luck...

I have something similar to a magic 8 ball app

Right now when i face the phone downwards it loads a picture from a site, but it runs about 10 times until i face the phone back up.... i have a simple if statement where if the Z value is less that -9.5 then run the code else dont do anything.... but since onSensorChange runs constantly due to gravity it runs over and over.... is there a way to make it run only once, then stop running until user place phone upwards again
 
Back
Top Bottom