Android Tutorial Android Device Unique ID - Alternative to PhoneId

Status
Not open for further replies.

LucaMs

Expert
Licensed User
Longtime User

Your answer is very complicated and at this time I have my usual headaches (also English does not help).

If you're right, a test is sufficient.

100 random pairs (or more, 100,000) and calculate how many of them are equal.
 

danijel

Active Member
Licensed User
Longtime User
Is it correct?

It runs 10 tests and count how many of them fails or not
total success will be around 50% (on 55,000)
total success will be around 10% (on 100,000)

WARNING: REALLY SLOW
 

Attachments

  • prob2.zip
    18.1 KB · Views: 435

LucaMs

Expert
Licensed User
Longtime User
It runs 10 tests and count how many of them fails or not
total success will be around 50% (on 55,000)
total success will be around 10% (on 100,000)

WARNING: REALLY SLOW

I did not understand.

The app calculates how many times two "Id" calculated at random are equal in proportion to the number of attempts. Probably never.

The probability that they are equal is 1 / (2 ^ 31)!



[using an emulator it is very fast, much less than one second]



[P.S. ops, you were referring to your project]
 
Last edited:

danijel

Active Member
Licensed User
Longtime User
Ok, we don't understand each other.

The probability that two numbers are equal is 1 / (2 ^ 31)! - That's correct.
But if you have 100,000 users i'm trying to say that very often 99,998 users will get unique number and only 2 users will get the same number !
so not all users will have unique number and that Test is fail!
If happens that all 100,000 users get unique number that test is successful!

And i'm saying that in 90% cases Test will faill

Like in lottery... chance for one person to win is 1:15,000,000,000
but every month somebody score. How is that? - Lot's of people play.
 

Shay

Well-Known Member
Licensed User
Longtime User
Using the code on first page (Erel) I cannot get ID from android tv device (getting 123456..)
and using the WIFI code I am getting 2:0:0:0:0... which is also not valid.
Any other way to get unique device id (especially from android tv devices?)
 

Informatix

Expert
Licensed User
Longtime User

LucaMs

Expert
Licensed User
Longtime User
Working method to get an unique ID:
https://stackoverflow.com/a/14893618
From that page:
  • Phone number/SIM card number (if available or just use zeros)
  • Android ID
  • Mac Address (if available or just use zeros)
So, if first and third element are zeros, you will use only Android ID. If it was enough, why should you use the other two?

Creating a rnd num (long) and saving it in the DirInternal is not a valid solution?
 

Informatix

Expert
Licensed User
Longtime User
I was in a bit of a hurry yesterday and I didn't elaborate. The idea to remember is that it is better to make an aggregate of several values than to simply rely on a single one. I implemented the proposed solution in my first application, My Playground, and I'm satisfied with it, but I didn't have a strict requirement.

Creating a random number that you save in a directory exposes you to the risk of hacking. Using the ID of someone else becomes pretty easy.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…