Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getDpi() failure on Android #18463

Open
slackmoehrle opened this issue Nov 12, 2017 · 5 comments
Open

getDpi() failure on Android #18463

slackmoehrle opened this issue Nov 12, 2017 · 5 comments
Assignees

Comments

@slackmoehrle
Copy link
Contributor

From US forums:

I am trying to get the device ppi but it looks like on android it’s wrong.

I tried a nexus 4 which has 318 ppi but when I do getDpi it returns 320.
I tried Samsung galaxy s7 and it returned 640 but it’s suppose to be 577.

It seems to work fine on ios…

Also I think it’s miss leading that it’s called getDpi for actually getting the ppi?

@bouc0277
Copy link

It looks like someone else had a similar issue: https://stackoverflow.com/questions/17703661/how-to-find-the-ppi-of-an-android-screen

My guess is that it's something in here

Maybe this is an issue with android DisplayMetrics ?

@dumganhar
Copy link

dumganhar commented Nov 13, 2017

It seems it's because we use getMetrics method in getDPI.
But since there are some devices which have virtual buttons in the bottom of screen, getMetrics will not include the size in the area of virtual buttons.
I searched some articles on the internet, found that there is a new API called getRealMetrics that will include the size of virtual buttons.
Yep, we need to modify the implementation of getDPI. I will try to reproduce it on some devices and try to fix it. Thanks for your feedback, @slackmoehrle .

@dumganhar
Copy link

@slackmoehrle , could you please add the link of this thread in the Engine forum?

@slackmoehrle
Copy link
Contributor Author

@Priority10
Copy link
Contributor

Ok, I just hope that these issues (this and #9419) will be closed together.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants