Identify device by using an unique identifier flutter / android

1,744

You can use the library below in order to find the device's unique ID:

Device ID library

Also this is a duplicate question, so please take care next time to search for the answer prior to asking a question. :)

Lastly, I am not entirely sure of the scope of your project but if you saving user data, sensitive or not on Firebase, logging people in with the devices UID's could be problematic for example in the situation of the user losing their phone they would not be able to recover their lost data. Like I said I'm not sure the scope of your project but just something to think about.

Please let me know if you need any further help!

Share:
1,744
Crate
Author by

Crate

Updated on December 25, 2022

Comments

  • Crate
    Crate over 1 year

    My use case is I want to uniquely identify my users devices as I want to provide them subscription and dont want to use any type of login instead use an unique identifier that I can save it on my backend so even if user uninstall or reinstall my app, still be able to access content. Also I've had tried to use androidId (SSAID) but it can change on app signin change or device reset. I am using firebase as backend and flutter on front end.

  • Crate
    Crate over 3 years
    Hey thanks for your quick response but as I mentioned I've already tried using this device_info (SSAID) but it changed 2 3 new builds so I cannot use this further, secondly I'm not using users sensitive information so user do not need to worry about it, if you can suggest any other ways to achieve this let me know
  • MattTheXPat
    MattTheXPat over 3 years
    Please check out the duplicate question I put in my answer as there are a few others ways and libraries of doing it. I am also just curious as to why you even have a database on the cloud if you are not concerned whether the users data is lost or not, why not use a local database?
  • Crate
    Crate over 3 years
    Didn't seem to find your answer, can you please refer it here and I'm using firebase because I'm providing access to premium content in my app as the user purchases the plan, the plan amount, content all are fetched from db as well as I'm using it for push notification
  • Crate
    Crate over 3 years
    And I'm wondering I had a build of my app 3 months ago and it's giving me different ssaid as compared to the build I made yesterday and fun fact I didnt even reset my phone also and tried checking from my friend's device got the same result as mine (showing different ssaid)
  • MattTheXPat
    MattTheXPat over 3 years
    I reviewed the answer I was looking at and it seems that the library is discontinued so maybe try this library as well as look at dart packages.I would suggest from what I can see using the devices UID's without a backups such a email and password sign in is rather risky and assuming you are storing the UID's in the database directly a hacker could potentially steal all of those UID's unless salted and its possible to get other users device ID's. Look, go with what you think is right, but thats just my view.
  • Crate
    Crate over 3 years
    yes I've taken email and attached to every uuid but if I roll out an update the new build, the uuid is not similar as previous one as it should be, so I've to ask the user for there email to give them access also cannot use this uuid as it will change after new releases.
  • Crate
    Crate over 3 years
    Does it change overtime or when device reset? Also does it change in lifetime ? or is it doesnot change
  • Khalil LAABOUDI
    Khalil LAABOUDI over 3 years
    No, IMEI number does not change after factory reset. Since the IMEI number is a part of the hardware, therefore, any reset that is software-based will not be able to change the IMEI of your phone.
  • MattTheXPat
    MattTheXPat over 3 years
    Crate, please don't forget to mark the correct answer for future to see. :)
  • Crate
    Crate over 3 years
    okay seems fair, but as I searched about if I've dual sim phone, I would be getting 2 IMEI's
  • Crate
    Crate over 3 years
    I'll get back to this post after I try these solution. Glad you guys helped !!