Using onPause() and onResume() to register and unregister
broadcastreceiver