The issue is with ios device when user uninstall and reinstall the app it will generate new UUID which is not unique.
On an android device we can get a unique device UUID.
The issue is with ios device when user uninstall and reinstall the app it will generate new UUID which is not unique.
On an android device we can get a unique device UUID.
Here i got the trick for it.It worked for me.
Use Keychain plugin
The Keychain plugin allows you to securely store data in the iOS Keychain.
You can set, get, and remove values in the Keychain using this plugin. Items stored in the Keychain survive uninstalls and reinstalls of your app. The data is not available to any other app, unless it's signed with the same provisioning profile. When a user backs up iOS data, the keychain data is backed up, but the secrets in the keychain remain encrypted in the backup.
The Keychain stores data as key-value pairs. You need to set and get these pairs using the same servicename. If you set an existing key with a new value, the old value will be overwritten
Phonegap Build user just use this plugin into config.xml file
<plugin name="cordova-keychain" source="npm" />
How to use it in App?
// prepare some variables
var servicename = 'MyAppUUID';
var key = 'MyApp';
var value = 'Your UUID'; // Set your Device Id here.
// prepare the callback functions
function onSuccess (msg) {alert(msg)};
function onError (msg) {alert(msg)};
// store your password in the Keychain
new Keychain().setForKey(onSuccess, onError, key, servicename, value);
// get your password from the Keychain
new Keychain().getForKey(onSuccess, onError, key, servicename);
// remove your password from the Keychain
new Keychain().removeForKey(onSuccess, onError, key, servicename);