with cocs2dx in c++, is there a simple way to dectect if my app is running on tablet or on smartphone?
I need this info for tracking/report iusse, not for graphic.
I’m manually calculating the screen size to distinguish between a phone or a tablet, given that everything above 7 inches is a tablet (in my opinion). As far as I know there’s no other solution that works on both ios and android.
int dpi = Device::getDPI(); float xInches = director->getWinSize().width / dpi; float yInches = director->getWinSize().height / dpi; float diagonalInches = sqrtf(xInches * xInches + yInches * yInches); diagonalInches = roundf(diagonalInches * 100.0f) / 100.0f; bool isTablet = (diagonalInches >= 7.0f);
Thank you very much… I’ll try it out!
Android exposes telecom services through the APIs.
Maybe you can use those provided APIs.
@domp this is amazing - thank you!