My system is a little custom and complicated and tailored for me specifically, but basically my device periodically sends a ping to a service I built in cloud. I also have something like the google inactive account manager set up which is probably easiest for most people who use gmail: