Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15437] Android: Titanium.Platform.displayCaps.dpi incorrect for Samsung S4 / Sony Experia Z emulator

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionNot Our Bug
Resolution Date2013-10-09T22:00:33.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid
Labelsandroid
ReporterFabiano Taioli (vista)
AssigneeIngo Muschenetz
Created2013-09-26T07:54:03.000+0000
Updated2017-03-29T20:59:49.000+0000

Description

I'm testing a simple titanium app on an android avd obtained from a Xperia Z device definition (similar to samsung s4). The app works but I got a wrong value for Titanium.Platform.displayCaps.dpi The app report a wrong value for Titanium.Platform.displayCaps.dpi = 320 (avd has a dpi of 480). If can help finding a solution the Ti.Platform.displayCaps.platformWidth correctly report 1080. Attached AVD config

Attachments

FileDateSize
Schermata 2013-09-25 alle 10.22.40.png2013-09-26T07:54:03.000+000078581

Comments

  1. Jamie Buckley 2013-10-03

    [~morahman] He isn't using the actual device, he is using an AVD simulator based on the device, you should be able to create a custom simulator based on this to test.
  2. Tommy Leung 2013-10-08

    This is a problem on the emulators only. It seems to work fine on the actual device. Googling indicates this is a problem on native applications as well and is a problem with the emulator.
  3. Fabiano Taioli (vista) 2013-10-09

    I have no the real device to test but may be really an emulator issue. I was able to force the right DPI values on emulator with this commands: > adb shell setprop qemu.sf.lcd_density 480 > adb shell stop > adb shell start
  4. Ingo Muschenetz 2013-10-09

    From the comments, it _sounds_ as if this is an emulator bug, not an issue with the Titanium platform. [~tlsg] do you have any links? Otherwise, can you please provide the following:

    Steps you used to create the emulator.

    Sample app you used to test the theory

    Actual vs. expected results (I'm assuming alert of Titanium.Platform.displayCaps.dpi displays 320,nut browsing the info of the AVD displays 480)

  5. Tommy Leung 2013-10-09

    This is SO for the commands Fabino found: http://stackoverflow.com/questions/12919341/any-suggestions-on-getting-xxhdpi-working-in-the-android-emulator This is one of the many places developers were complaining about the wrong dpi: http://www.basic4ppc.com/android/forum/threads/density-for-1080x1920-is-not-correct.29686/ And looking at the code for Ti, the reported dpi is indeed just calling the same underlying android function "context.getResources().getDisplayMetrics().density" so it would make sense that this is an emulator problem.
  6. Ingo Muschenetz 2013-10-09

    Based on comments, this appears to not be our bug. Resolving as such.
  7. Lee Morris 2017-03-29

    Closing ticket as it has been established that the issue is not our bug.

JSON Source