Search code examples
androidiosiphonecordovaaccount

Cordova App - how to detect if it is the same device / account


I am creating a Cordova mobile app that will have a local database that will store some user-chosen settings. I will also be sending the user preferences to a server.

I would like the user preferences to persist even if they delete the app and reinstall it.
It would also be desirable if the preferences persisted across multiple devices the user owns (via their Google Play account, or their Apple ID), but that is not critical.

I don't want the user to need to create an account for my app.

One option is to get the UDID of the device and use that to reconnect to the "same" account but I understand that is not actually reliably the same after multiple installs.

Ideal is probably like the Google Play account, and the iTunes Account. I've seen Android games and Apple apps that use that. Is there a Cordova plugin that gives access to both of those?

What is a good simple solution for a cross-platform app to know if it running on the same device as it was previously run on?


Solution

  • After digging deep into this issue, I could get one ready-made plugin which should possible resolve this issue - UniqueDeviceID plugin

    The plugin claims that the ID remains the same after app uninstalls. But I could see somebody facing issue after app updates as it returns different IDs. Some solutions have also been posted on the same issue comments.

    Nevertheless, this is the only plugin I could find matching the OP's requirement to the closest. Even if some tweaks needs to be done to address some issues, I feel this plugin should be the starting point. Hope it helps. Cheers