N niqpw Member Licensed User Longtime User May 25, 2011 #1 Hi Is there any way to generate a GUID, as is possible in VB? I would like to create an identifier, which can be generated on a phone and must be unique (i.e. no one else would produce the same one, even on the same device), so any other suggestions would be great. Thanks!
Hi Is there any way to generate a GUID, as is possible in VB? I would like to create an identifier, which can be generated on a phone and must be unique (i.e. no one else would produce the same one, even on the same device), so any other suggestions would be great. Thanks!
N niqpw Member Licensed User Longtime User May 25, 2011 #3 Nice try! But it has to be unique each time the user uses the app. I guess something like this as a string: http://developer.android.com/reference/java/util/UUID.html Last edited: May 25, 2011 Upvote 0
Nice try! But it has to be unique each time the user uses the app. I guess something like this as a string: http://developer.android.com/reference/java/util/UUID.html
Erel B4X founder Staff member Licensed User Longtime User May 25, 2011 #4 You can do this with the Reflection library: Code: Sub Activity_Create(FirstTime As Boolean) Dim key As String key = GetUniqueKey End Sub Sub GetUniqueKey Dim r As Reflector r.Target = r.RunStaticMethod("java.util.UUID", "randomUUID", Null, Null) Return r.RunMethod("toString") End Sub Upvote 0
You can do this with the Reflection library: Code: Sub Activity_Create(FirstTime As Boolean) Dim key As String key = GetUniqueKey End Sub Sub GetUniqueKey Dim r As Reflector r.Target = r.RunStaticMethod("java.util.UUID", "randomUUID", Null, Null) Return r.RunMethod("toString") End Sub
N niqpw Member Licensed User Longtime User May 25, 2011 #5 Thanks Erel, exactly what I was looking for :sign0098: Upvote 0