Automatically handles disconnections/reconnections when app becomes inactive