You can use device.advertising_id or device.vendor_id. These identifiers shouldn't be changing, so you can spot reinstalls.