Added onResume and onPause

starting and stopping the accelerometer when app is not running