trigger a 'appstate' event when sending heartbeat

Signed-off-by: Manson Li <manson.li@matchstick.tv>