Can any one tell how to get device id (unique id)?
ionic install cordova-plugin-device --save
In your TS:
import {Device} from 'ionic-native';
import {Platform} from 'ionic-angular'; //for detect OS
When you need to use it:
declare var device: any;
constructor(private platform: Platform) {
//uuid
console.log(device.uuid);
//os and version
let system = this.platform.is('ios') ? 'ios' : (this.platform.is('android') ? 'android' : 'windows');
console.log(system + '@ ' + device.version);
}
Dear @twicejr,
When I try the command
ionic install cordova-plugin-device --save
I got
[ERROR] Unable to find command: install cordova-plugin-device
please advise
to install Cordova plugins, use: cordova plugin add cordova-plugin-device
Plugin info: https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-device/
It should be npm install …, I suppose…
I have now problem of
[ts] Cannot find module ‘ionic-native’.
as shown in import section
Please advise how to fix it
N.B I am using ionic 3…
Thanks
Anes
This is not compatible with ionic 3.
You should fork this plugin or look for another alternative.
See upgrade guide from Ionic 2>3 and apply these changes, if you are
able to do it.
I got no time for this right now.
Dear @htbill
I got Runtime error as ERROR Error: Uncaught (in promise): Error: No provider for Device!
Please advise
Thanks
Import this :->
import { Device } from ‘@ionic-native/device/ngx’;
providers: [
Device
],