Samsung / tizen-common-web

Apache License 2.0
11 stars 4 forks source link

Question: Check available storage on device #8

Open ionescu77 opened 3 years ago

ionescu77 commented 3 years ago

Hello,

I am back again.

Can you please help me in providing a typescript example for using the SystemInfo API to find out free INTERNAL storage space left on device? For example the Tizen Web App will download some files (to the Downloads folder), but needs to check first there is enough free space available. (Tizen 4.0 - 6.0)

Thank you!

PS: https://docs.tizen.org/application/web/api/4.0/device_api/mobile/tizen/systeminfo.html#SystemInfoStorage

SejoongDeJang commented 3 years ago

Hi check the followed code.

import { systeminfo } from 'tizen-common-web
systeminfo.getPropertyValue('STORAGE', (property)=>{
    console.log('property')
})

Then I got storage property like below on the inspector

SystemInfoStorage {units: Array(1)}
  units: Array(1)
    0: SystemInfoStorageUnit
      availableCapacity: 905261056
      capacity: 4130078720
      isRemovable: false
      isRemoveable: (...)
      type: "INTERNAL"
    get isRemoveable: ƒ ()
    set isRemoveable: ƒ ()
    __proto__: Object
    length: 1
  __proto__: Array(0)
ionescu77 commented 3 years ago

Hello, thank you for your reply.

yes I tried:

import { systeminfo } from 'tizen-common-web
systeminfo.getPropertyValue('STORAGE', (property)=>{
    console.log('property')
})

However the code did not work (the application is running on SSSP displays - digital signage), I thought maybe STORAGE is not implemented on some displays.

I was wondering how I can extract and use availableCapacity in code.

Should I first get systeminfo.getPropertyValue('STORAGE', ...) and then somehow extract the values from the SystemInfoStorage interface!!??

SejoongDeJang commented 3 years ago

There is difference between us. My device is a TV.

Can you connect to forum? This package is for supporting typescript API. And I guess, the 'systeminfo.getProperty` doesn't work on the digital signage.