I tried this plugin as tutorial
my test simple page class:
export class Page1Page implements OnInit {
label1 = 'label1'
constructor(
private platform: Platform,
private extendedDeviceInformation: ExtendedDeviceInformation
) {
console.log('call constructor')
}
showInfo() {
this.label1 = this.extendedDeviceInformation.cpumhz
const obj = this.extendedDeviceInformation
console.log('extendedDeviceInformation', obj, obj.cpumhz, obj.memory);
}
ngOnInit() {
console.log('call ngOnInit')
this.platform.ready().then((result) => {
console.log('platform ready', result)
this.showInfo()
})
}
clickButton1() {
console.log('clickButton1!');
this.showInfo()
}
}
In source of this plugin:
https://raw.githubusercontent.com/danielehrhardt/cordova-plugin-extended-device-information/master/www/extended-device-information.js
we can see line:
console.log(‘Device Data’, info);
In my console this displayed as expected (red arrow on my screenshow)
But object this.extendedDeviceInformation in my page class always empty (green arrows)
I try wrap it to ready, click hanlder etc.
My question is how to fix this? Thanks!
p.s code of my view template
...
<h1>Label1: {{label1}}</h1>
<ion-button (click)="clickButton1()" expand="block">button1</ion-button>
...
p.p.s I have tried also similar plugins, they work as expected. (Device, AppVersion, BuildInfo, etc)
1 post - 1 participant
