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

Get help using Construct 2

Post » Wed Nov 23, 2016 4:33 pm

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
B
59
S
9
G
1
Posts: 970
Reputation: 6,611

Post » Thu Nov 24, 2016 4:34 am

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.
Note: I am not active anymore. If you need to reach me for one of my games, you can do so by emailing me at [email protected]
B
63
S
25
G
8
Posts: 36
Reputation: 8,443

Post » Thu Nov 24, 2016 4:54 am

@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.
B
59
S
9
G
1
Posts: 970
Reputation: 6,611

Post » Thu Nov 24, 2016 8:03 am

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.
Note: I am not active anymore. If you need to reach me for one of my games, you can do so by emailing me at [email protected]
B
63
S
25
G
8
Posts: 36
Reputation: 8,443

Post » Thu Nov 24, 2016 8:22 am

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
B
9
S
4
G
1
Posts: 33
Reputation: 873

Post » Thu Nov 24, 2016 11:38 am

Devices usually actually hide their UDID from apps for privacy reasons. Using a random ID saved in storage is pretty much the same though.
Scirra Founder
B
403
S
238
G
89
Posts: 24,653
Reputation: 196,143

Post » Thu Nov 24, 2016 2:48 pm

@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.
B
59
S
9
G
1
Posts: 970
Reputation: 6,611


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 22 guests