【问题标题】:Not able to get Ram And storage information in ionic无法在离子中获取 Ram 和存储信息
【发布时间】:2020-03-01 21:01:20
【问题描述】:

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

 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);
}}

【问题讨论】:

    标签: cordova ionic-framework ionic-native


    【解决方案1】:

    我知道这是一个迟到的回复,但它可能对其他正在寻找答案的人有用。 您可以直接通过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;
    
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-07
      • 2010-12-09
      • 2018-06-20
      • 2011-08-06
      • 2020-04-16
      • 2018-11-29
      相关资源
      最近更新 更多