-1

I need a unique media id for each media which I will upload on a server in my app, because of some reason I need to create it from the Android side. Can anyone suggest any best way to achieve this?

Sazid Ali
  • 21
  • 7

3 Answers3

0

You can generate unique id using below code:

UUID.randomUUID().toString()

it will return a unique string.

subrahmanyam boyapati
  • 2,836
  • 1
  • 18
  • 28
0

finally, I find the solution, I am using userId+System.currentTimeMillis() and create a unique code, it is unique for each media and also for each user.

Sazid Ali
  • 21
  • 7
-1

for unique Id use current Time in miliseconds

System.currentTimeMillis();