Separate heartbeat functionality from ApplicationConnection

* Correctly cancels the timer if the interval is updated
* Listens to ApplicationStoppedEvents and disables the heartbeat (#13249)

Change-Id: I5f4f778583954a1dd22ffeb39ef3b8fa07b85a1c