According to the net, the most recommended method in generating unique id is to use the Settings.Secure.ANDROID_ID. However, Settings.Secure.ANDROID_ID has a bug on Android 2.2. I am using Android 2.2 so I can't use it. On the other hand, there is also the mac address of the wiFi device and the TelephonyManager.getDeviceId(). The ID that I will be generating will be used as the session ID on the server side so it must be unique.
Will I be okay with just using the mac address of the wiFi as my unique ID and the device ID of the phone as fallback if the device has no wiFi interface? The application needs connection to the internet and so a wiFi interface or deviceId for phone will surely be present right? Or is it a bad idea?
I am also considering the use of UUID.randomUUID(). But even though there is a very small chance of generating the same id here, the probability still exist.
What ID can I use if that ID must also serve as session ID on the server? Also, please note that if the ID is already existing on the server, the ownership of the session will be given to the new user.