Ionic 3 - Uniquedeviceid not working on Android 10 device

Project Type: ionic-angular (ionic 3) Using cordova for native functionality.
Project Dependencies :

"dependencies": {
    "@angular/animations": "5.2.10",
    "@angular/common": "5.2.10",
    "@angular/compiler": "5.2.10",
    "@angular/compiler-cli": "5.2.10",
    "@angular/core": "5.2.10",
    "@angular/forms": "5.2.10",
    "@angular/http": "5.2.10",
    "@angular/platform-browser": "5.2.10",
    "@angular/platform-browser-dynamic": "5.2.10",
    "@ionic-native/android-permissions": "^4.7.0",
    "@ionic-native/camera": "4.3.3",
    "@ionic-native/contacts": "^4.7.0",
    "@ionic-native/core": "4.7.0",
    "@ionic-native/device": "^4.7.0",
    "@ionic-native/in-app-browser": "^5.28.0",
    "@ionic-native/keyboard": "^4.7.0",
    "@ionic-native/native-page-transitions": "^4.7.0",
    "@ionic-native/native-storage": "^4.10.0",
    "@ionic-native/network": "^4.7.0",
    "@ionic-native/social-sharing": "^4.7.0",
    "@ionic-native/splash-screen": "4.7.0",
    "@ionic-native/status-bar": "^4.7.0",
    "@ionic-native/unique-device-id": "^4.7.0",
    "@ionic-native/wheel-selector": "^4.7.0",
    "@ionic/storage": "2.1.3",
    "@ngx-translate/core": "8.0.0",
    "@ngx-translate/http-loader": "^2.0.0",
    "@types/moment-timezone": "^0.5.12",
    "com.telerik.plugins.nativepagetransitions": "^0.6.5",
    "cordova": "^10.0.0",
    "cordova-android": "^9.0.0",
    "cordova-browser": "5.0.4",
    "cordova-plugin-android-permissions": "^1.0.0",
    "cordova-plugin-contacts": "^3.0.1",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-inappbrowser": "^4.0.0",
    "cordova-plugin-ionic-keyboard": "^2.0.5",
    "cordova-plugin-ionic-webview": "^1.1.19",
    "cordova-plugin-network-information": "^2.0.1",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-statusbar": "^2.4.2",
    "cordova-plugin-uniquedeviceid": "^1.3.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "cordova-plugin-x-socialsharing": "^5.4.0",
    "cordova-wheel-selector-plugin": "^1.1.1",
    "es6-promise-plugin": "^4.2.2",
    "ion-multi-picker": "^2.1.2",
    "ionic-angular": "3.9.2",
    "ionic-plugin-keyboard": "^2.2.1",
    "ionic2-auto-complete": "^1.6.2-alpha",
    "ionicons": "3.0.0",
    "moment": "^2.24.0",
    "moment-timezone": "^0.5.28",
    "ngx-chips": "^1.9.2",
    "ngx-intl-tel-input": "^1.0.6",
    "rxjs": "5.5.10",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.26"
  },
  "devDependencies": {
    "@ionic/app-scripts": "^3.2.4",
    "typescript": "~2.6.2"
  },

Uniquedeviceid is working fine on Android 9(Pie) and previous version of Android but not working on Android 10(Q) only. Application asks for the permission even after giving permission not working.

If I use cordova-android": “^8.0.0” then the same code and dependencies works fine for Android 10 as well like no problem in getting Uniquedeviceid. The problem lies in cordova-android": “^9.0.0”. But I don’t know how to tackle this issue.

Kindly any one suggest what i’m doing wrong.

1 Like

If needed more details kindly let me know.

First Thing to do if you have a Problem with a Plugin: Check the Github Issues. I found this one: https://github.com/Paldom/UniqueDeviceID/issues/36

I don’t know this Plugin, but the last commit is over 5 years ago, so i would definitely recommend to not use such an old and unmaintained plugin in an production app

1 Like

Thank you @EinfachHans. I have solved the problem using different plugin.

@ankit18 I have the same issue with phones Android 10 and above. Which plugin you installed to avoid this problem.

@priyankaprakasan Currently I’m using Universal Unique Identifier. Kindly check the link below: https://ionicframework.com/docs/v3/native/device/
It will definitely resolve your issue. Or else you have to find some other way.

But using this plugin: https://ionicframework.com/docs/v3/native/unique-device-id/ you will definitely not get app-specific device id as they have put some restriction on Android 10 and above for third parties application. So the third party application can’t get access to SIMSerialNumber, IMEI Number etc.

You have to go through the Android 10 doc and the git repo of both the plugins for the better clarity on this issue.

@ankit18 Thanks for the reply.