无法获取离子中的Ram And存储信息

时间:2018-07-10 11:46:46

标签: cordova ionic-framework ionic-native

当我尝试获取ionic中的ram信息和存储信息时,我得到的是空值。这是代码

 import { ExtendedDeviceInformation } from '@ionic-native/extended-device-information';

@IonicPage()
@Component({




 selector: 'page-location',


 templateUrl: 'location.html',

})


export class LocationPage {
 DeviceInfo={
Ram:'',
Storage:''}
constructor(private extendedDeviceInformation: ExtendedDeviceInformation,public navCtrl: NavController, public navParams: NavParams) {
console.log('The Memory is: ' + this.extendedDeviceInformation.memory);
console.log('The Memory is: ' + this.extendedDeviceInformation.totalstorage);
}}

1 个答案:

答案 0 :(得分:0)

我知道这是一个较晚的答复,但对寻求答案的其他人可能有用。 您可以直接通过cordova访问该插件。

import { ExtendedDeviceInformation } from '@ionic-native/extended-device-information';

declare var cordova: any;

@Injectable()

export class YourClass {

this.device_storage = cordova.plugins['extended-device-information'].totalstorage;

}