Easy way to tell if running on iPhone, or iPad


#1

Hi, is there an API call to return this info?

thx


#2

This one?
SystemStats::getOperatingSystemType()

Returns the type of operating system we’re running on.
Returns
one of the values from the OperatingSystemType enum.

Returns:
https://juce.com/doc/classSystemStats#a7697c468b5f6c391096ab483690b68ea


#3

hi, that tells me I’m running on iOS, but not whether it’s a phone or tablet… Not actually sure if this info is directly available and maybe has to be inferred from display dimensions…?


#4

i added an extra comma t the title to make the intent clearer :wink:


#5

Ah, sorry. I thought that was too obvious :wink:


#6

What about:

#if JUCE_IPHONE
bool itsMeTheiPhone = true;
#else
bool itsMeTheiPhone = false
#endif

#7

SystemStats::getDeviceDescription()

You may want to use this for things like determining the type of phone/iPad, etc.


#8

ah, thx - will take a look into that.


#9

Perfect, returns “iPad” or “iPhone”. thanks