I'd like to notify my users if a login happens from a new device. Like Google does for Gmail logins. Android ID and IMEI usage for tracking is discouraged by google. How can I track devices without using hardware identifiers? What is the best way to track devices without violating users privacy?

  • Is there a reason you need to track devices? What you are talking about is no different than basic session tracking. Sep 11, 2019 at 1:44

1 Answer 1


From your description it seems that for your purposes, a persistent file in your app will be enough. You will get some 'false positives' when users wipe the app data, or uninstall your app and reinstall it later, but this should not be a big problem if it only results in a private mail notification, as for Google logins.

  • Why do you need a persistent file? What you are describing sounds like an off-the-cuff cookie. Why not just use a cookie that never expires? Sep 11, 2019 at 1:42
  • We are not talking about web browser here, but you are right: this file would essentially not do more than a infinite-expiration cookie
    – Alex Cohn
    Sep 11, 2019 at 5:45
  • Sure, of course it's not a browser, but any HTTP client can send cookies. I'm presuming that the HTTP clients available to phones will also handle any cookie requests sent by the server. Obviously you don't literally have to use cookies, but conceptually this is just a matter of creating and tracking sessions. Sep 11, 2019 at 9:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .