Search code examples
huawei-mobile-serviceshuawei-developers

Problem while getting device information in Huawei QuickApp


I am developing a quick app and I am having a problem while calling method below.

device.getInfo()

I am trying to obtain my phone's height from the information provided but it always returns 0.

Any suggestions?


Solution

  • Please check whether the asynchronous mode is used when the device.getInfo() method is invoked in the onCreate() method in the app.ux file. If so, delete the asynchronous mode.

    After the asynchronous mode is deleted, if the height is still 0, the device.getInfo() method may be invoked before the data is ready. It usually takes around 50-100 ms for the data to be ready.