I'm using @ionic-native/device plugin in my ionic application in order to detect the underlying device running the application. However, when I try to use it I get the Device object with all properties set to null.
Note:
this is NOT a duplication of This question since the problem occurs even when running cordova run browser
or running in android...
I've installed the @ionic-native/device plugin and used it as follows:
App.module.ts:
import { Device } from '@ionic-native/device/ngx';
@NgModule({
// ...
providers: [
Device,
]
//...
})
export class AppModule { }
App.component.ts:
constructor(private device: Device) {
console.log('Device is: ', this.device);
}
package.json:
"dependencies": {
...
"@ionic-native/core": "^5.24.0",
"@ionic-native/device": "^5.26.0"
}
What is missing?