Vielleicht braucht jemand ja folgenden Code. Das Problem was ich mit den meisten im Netz gefundenen Beispielen hatte ist, das selbst 7" *hüstel* Telefone als Tablets erkannt werden.
Delphi-Quellcode:
function GetIsTablet: Boolean;
{$IFDEF ANDROID}
const
DENSITY_HIGH = $F0;
DENSITY_MEDIUM = $A0;
DENSITY_TV = $D5;
DENSITY_XHIGH = $140;
DENSITY_DEFAULT = DENSITY_MEDIUM;
var
Metrics: JDisplayMetrics;
{$ENDIF}
begin
{$IFDEF IOS}
result := TUIDevice.Wrap(TUIDevice.OCClass.currentDevice)
.userInterfaceIdiom = UIUserInterfaceIdiomPad;
{$ENDIF}
{$IFDEF ANDROID}
result := (MainActivity.getResources.getConfiguration.screenLayout and
TJConfiguration.JavaClass.SCREENLAYOUT_SIZE_MASK) >=
TJConfiguration.JavaClass.SCREENLAYOUT_SIZE_LARGE;
if result then
begin
Metrics := TJDisplayMetrics.Create;
MainActivity.getWindowManager.getDefaultDisplay.getMetrics(Metrics);
result :=
(Metrics.densityDpi = DENSITY_HIGH) or
(Metrics.densityDpi = DENSITY_MEDIUM) or (Metrics.densityDpi = DENSITY_TV)
or (Metrics.densityDpi = DENSITY_XHIGH);
end;
{$ENDIF}
end;
Christian