How do I get the UDID from a phone? or other unique ID?

0 favourites
  • 7 posts
  • Hi there,

    I have a simple leaderboard system that my partner has developed. it uses a simple ajax call to send a score. the idea is that it doesn't require any kind of login to connect and get data for it. When you submit you do need to provide some kind of unique ID and the phones UDID would almost certainly be the best way to insure this.

    However I also am open to other ideas that might not be so air tight but likely in most cases to be ok. one idea I had was to have the app when first launched do a time check and timestamp as the UDID. This isn't perfect. Technically two people could install at the same time, but it should be very rare.

    There are likely better ideas that this though. Anyone have experience with this?

    Thanks,

    Caleb

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Im making an online game that sync's the players data to a server, so this was a big problem for me. My solution is a bit more complicated because I track the players Google user ID (which requires a service like firebase), but you could get around this problem by simply simply creating a UDID using a long string of random numbers in local storage.

  • austinblackbelt thanks for confirming. i was hoping maybe i was just overlooking something, but yea your suggestion is what i ended up going with.. as it is i'm making an integer between 1 and 1 million. I figure that's plenty for now.

    How exactly are you tracking google user id?

    I'm also wondering about a facebook plugin, though I know that might be a can of worms for basically one point of data.. but yea I'm just exploring all options at this point.

  • I'm using Rex's firebase plugins to connect with firebase for data storage and to retrieve the Google user ID. Basically, when the game starts I check if a userid is assigned in local storage. If there is one I just use that but if their isn't, I use firebase authentication to get one and set it to local storage. Also, firebase authentication can be used through Google, Facebook, and you can use even setup email and password authentication. All of these will give a userid when the user signs in.

  • I have a similar problem with a log system, and in my opinion the best idea would be to:

    • check if the game instance has a Unique id variable set;

    -if not, call a server that register that device in a database table, returning the just inserted primary key (that would be unique)

    -saving that value in the game instance variable Unique id

    This way, no matter what, any device would be an unique id

  • Devices usually actually hide their UDID from apps for privacy reasons. Using a random ID saved in storage is pretty much the same though.

  • Ashley thanks for confirming. I think that anyone using a serious leaderboard system for a large scale game would be better off using facebook or some other service like that.

    Walessio yea I was talking with my buddy who made our leaderboard system. For now we'll leave it be, but yea if a game were ever to go large scale something airtight would be good.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)