Android Question

Get unique device ID in android

I would like to know how to get a String that uniquely identify the current device in android.
I know this has been asked before but all the answers are the same: to use the ANDROID_ID constant. The thing is that it is deprecated and also insecure. Is there any other possibility?

Thanks.

Answer Source

There is no ideal way. Best way is to generate one on your own and then reuse it till app is installed. You can use

 String uniqueId = UUID.randomUUID().toString(); 

Generate it the first time the app launches and save it in your shared preference for further use.. This will change after every new installation and hence you can track app installations as well.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download