UDID replacement?

hi all,

i am checking on Corona sample code under PubNub sample

  
-- create a unique player id, hash the UDID  
my\_player\_id = crypto.digest( crypto.md4, system.getInfo("deviceID"))  

So, should i proceed with this since UDID is banned by Apple.
What could be the replacement?
Thanks
[import]uid: 10373 topic_id: 24499 reply_id: 324499[/import]

good question, i am also looking forward to know the details about this… [import]uid: 80100 topic_id: 24499 reply_id: 99169[/import]

Apple depreciate UDID cuz if you call it from iOS API it’s will be send as plain text so if you put md5 on it they will not reject your app.
BTW. This is unofficial but very popular replacement for UDID:
https://github.com/ylechelle/OpenUDID [import]uid: 12704 topic_id: 24499 reply_id: 99182[/import]

Another solution for those interested in more options:
http://blog.tele-optics.com/secureudid-is-an-open-source-solution-to-the-apple-udid-problem [import]uid: 70847 topic_id: 24499 reply_id: 99197[/import]

Since these are open-source, theres no rush to find another alternative, but :

If there isn’t a ‘key’ file in the documents folder when you start up, note the time and date.
Add a random number.
If you like, use MD5 to turn the results into a UID
Store that in the key file.

It will stay put unless the user re-installs.
It will be unique for that user and device, for your application.
[import]uid: 108660 topic_id: 24499 reply_id: 99202[/import]

Why do we need it anyway?

Doesn’t it make more sense to uniquely the person using the phone rather than the phone itself?

I can whip out a solution in a couple of hours that would make having a unique userid with a simple PHP and MySQL database.

The reason why? because it’s there and its convenient.

So I had a brain fart, er. Epiphany today. Why not write my own…

So a couple of hours later, here’s what I’ve got.

I setup a PHP/MySQL server that will generate a unique ID with a provided AppID. I suggest using the typical com.yourdomain.appname as the appID.

http://omnigeekmedia.com/api/getuid.php?appid=com.yourdomain.appname  

It returns a JSON structure on success that contains the uniqueID

Now on the Lua side, you need a little bit of code to make it work. Here’s where I’m at, but I have an error. Maybe someone can help me figure out my problem:

getuid.lua

module(..., package.seeall)  
  
local http = require("socket.http")  
local json = require("json")  
  
function getuid(appid)  
 local r, e  
 local result  
  
 print("appid", appid)  
  
 r, e = http.request("http://omnigeekmedia.com/api/getuid.php?appid=" .. appid)  
  
 if e == 200 then  
 result = json\_decode(r)  
 return result.uid  
 end  
 return nil,result.message  
end  

And my main.lua:

local getuid = require("getuid").getuid()  
  
local AppID = "com.omnigeekmedia.testapp"  
  
guid = getuid(AppID)  
  
print(guid)  

The error I’m getting is that appid is nil when the function calls, but I’m clearly passing the AppID in.

The code inside the function works when appid is not nil.

Thoughts?

Anyone want to test it?
[import]uid: 19626 topic_id: 24499 reply_id: 99236[/import]

The problem is in line 1 of your main.lua.
You’re calling the function with a nil argument instead of assigning the function to the local variable.

This should work:
[lua]local getuid = require(“getuid”).getuid

local AppID = “com.omnigeekmedia.testapp”

guid = getuid(AppID)
print(guid)[/lua]

You also need to change json\_decode to json.decode in getuid.lua. [import]uid: 70847 topic_id: 24499 reply_id: 99306[/import]

Thanks… I was having a major brain block yesterday.

I’ve published this to the community code.

Have at it!
[import]uid: 19626 topic_id: 24499 reply_id: 99352[/import]