This is a mechanical tilt switch where a metal ball resides inside the can. When the device is tilted more than 30 degrees above or below the horizontal, the ball will travel and connect the two pins, forming a short circuit between the two pins. This connection can be used to sense when a device has been tilted.