Micro app stops after few minutes

You can always do sync.now() to force a sync. No need to wait for the heartbeat.

For your other questions, see this topic: