Native: tried calling Device.platform, but the Device plugin is not installed

Hi Team,

I am new to Ionic 2 and still learning with angular 2. I have already created a demo project and it working fine. Now I am trying to get device details but it show me that Device Plugin not installed. How ever I have already added them in my project using command

ionic plugin add cordova-plugin-device -save

I am using ionic-native: 2.4.1 and cordova-plugin-device: ~1.1.4 and add cordova.js at the top in index.html file. I am using the following to get device details:–

platform.ready().then(() => {
console.log(Device.platform);
console.log(Device.uuid);
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
StatusBar.styleDefault();
Splashscreen.hide();
});

but both console log showing me null value and giving me warning as

Native: tried calling Device.platform, but the Device plugin is not installed

Please guide me where the problem is?

How are you testing this? ionic serve? On simulator? On device?

Hi Sujan,

I am using ionic server. It working properly when use ionic run androd.