当我尝试在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);
}}
我意识到这是一个迟到的回复,但它可能对其他寻找答案的人有用。 您可以直接通过科尔多瓦访问该插件。
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;
}