![]() |
Android - Phone oder Tablet
Hallo,
wie kann ich unter Android unterscheiden, ob die App auf einem Handy oder Tablet ausgeführt wird? Bei
Code:
ist das leider nicht zu erkennen.
TJBuild.JavaClass.MODEL
Unter iOS ist das mit UIDevice recht einfach. Da steht dann beim Modell auch nur iPhone bzw. iPad
Code:
Sowas bräuchte ich für Android auch.
Device := TUIDevice.Wrap(TUIDevice.OCClass.currentDevice);
NSStrToStr(Device.model); viele Grüße |
AW: Android - Phone oder Tablet
Delphi-Quellcode:
class function TMyDeviceInfo.isPhoneMode(form:TForm):boolean;
var FMyCustomMV : TMyDeviceInfo; ThisDevice: TDeviceInfo; begin try FMyCustomMV := TMyDeviceInfo.Create(form); TPlatformServices.Current.SupportsPlatformService(IFMXDeviceService,FMyCustomMV.FDeviceService); ThisDevice := FMyCustomMV.GetDevice; case ThisDevice.DeviceClass of TDeviceInfo.TDeviceClass.Phone: begin Result:=true; end; TDeviceInfo.TDeviceClass.Tablet: begin Result:=false; end; TDeviceInfo.TDeviceClass.Desktop: begin Result:=false; end else begin Result:=true; end; end; except on E: Exception do begin Result:=false; end; end; end; |
AW: Android - Phone oder Tablet
Liste der Anhänge anzeigen (Anzahl: 1)
Hier noch die gesamte Klasse, du musst nur das Logging entfernen.
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 20:13 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz