Uniquely identifying user or device in Cordova using least permissions

What is the least invasive way to uniquely identify a user or a user's device in Cordova. I've not yet been looking at iOS yet, but it looks like ANDROID_ID is definitely not unique, which rules out org.apache.cordova.device.Device 's uuid property.

Specifically, this is for recovering remote user account data in case of a phone- or application-data reset and I am trying to figure out how to do this with the fewest app permissions and the smallest cognitive load on the user.

Currently, I think the only routes I have are:

  • Ask user for email
  • Use third-party authentication (OpenID, Facebook, Twitter, Weibo, etc.)
  • Ask user for a uname/password

  • If your problem is only about backups, I don't know about Cordova/iOS, but Android has a standard backup service meant for this, which should work on even non-Google firmwares (assuming the ROM-maker did integrate a backup service)

    Concerning having a unique ID, I don't think there is any obvious answer, it depends on your more precise need:

  • According to the link you gave, the non-unique ANDROID_ID bug only applies to <= 2.2, is that relevant for your use-case ? (Edit: Though ANDROID_ID will change after phone-reset, so that doesn't match your need)
  • Asking user for email means taking care of spams
  • username/password means have proper security, not to leak infos
  • My personal preference is third-party authentificatino, but then you'll need your users to have a google account/facebook/etc, which you might not want
  • Also, one problem you might want to consider, is that Android devices are getting more and more multi-user capable. Do you want to a identify a device or a user ? If the later, one user might have multiple devices for the same application.


    If you want to identify an user then you have to use any of the routes you though and any of them will require permissions, so it's up to you which one to choose.

    For identifying a device, the best choice is to use the IMEI for phones and the Build.SERIAL for devices that don't have IMEI (tablets, media players), you will have to create a plugin to get those values

    链接地址: http://www.djcxy.com/p/70162.html

    上一篇: Android M电子邮件完成

    下一篇: 使用最少权限在Cordova中唯一标识用户或设备