I have a downloadable Ruby client which users can install on various devices they own. The client just runs every so often and sends various data to a server.
I would like to be able to uniquely identify each of a user’s devices so that I can tell which device various request originated from.
- The ideal identifier would exist cross platform so that I can use is on OSX, Windows, Android etc.
- It is not necessary for it to be unique among the set of all computers, just unique among the set of a single user’s computers.
- I would rather not write my own identifier to the file system if that can be avoided.
- The identifier should persist. Permanently if possible.
What is the simplest way to do this?
Thus far, I haven’t found a satisfactory way to do this without writing to the users machine.
Currently, I use the UUID gem to write a 36 char unique identifier to the filesystem and then read it back whenever I have to.
Another option if you are using > Ruby 1.9.2 is to use the SecureRandom.uuid method which does the same thing. This method is not available in Ruby 1.8.7 however.