Add onResume and onPause methods.