有没有办法检查Delphi应用程序中的iOS版本?我想在Delphi XE6中为iOS7和iOS6创建特定的代码片段.
如果您可以在 Firemonkey 项目中启用 GPS 服务,我正在徘徊?位置传感器没有启用它。如果启用了 GPS 或您有网络位置,它只能获取 GPS 坐标。
在其他一些 Android 应用程序中,它会询问您是否要启用 GPS,如果您同意,它将为该应用程序启用 GPS。我也想做这个。
我已经知道如何检查是否为 Android 启用了 GPS 服务,但不知道如何自行启用它。
下面的代码是如何检查是否启用了 GPS:
uses
Androidapi.JNI.Location,
Androidapi.JNIBridge,
FMX.Helpers.Android,
Androidapi.JNI.GraphicsContentViewText;
{$R *.fmx}
procedure TForm1.Button1Click(Sender: TObject);
var
locationManager : JLocationManager;
begin
locationManager := TJLocationManager.Wrap( ((SharedActivity.getSystemService(TJContext.JavaClass.LOCATION_SERVICE)) as ILocalObject).GetObjectID);
if locationManager.isProviderEnabled(TJLocationManager.JavaClass.GPS_PROVIDER) then
; //do something
if locationManager.isProviderEnabled(TJLocationManager.JavaClass.NETWORK_PROVIDER) then
; //do something else
end;
Run Code Online (Sandbox Code Playgroud)
如果你用 Java 编程,我也尝试过这样做。喜欢这个链接:https : //stackoverflow.com/a/5305835/2728408
procedure TForm1.Button1Click(Sender: TObject);
{$IFDEF ANDROID}
var
Intent: JIntent;
{$ENDIF}
begin
{$IFDEF ANDROID}
Intent := TJIntent.Create;
Intent.addCategory(TJIntent.JavaClass.CATEGORY_ALTERNATIVE);
Intent.setData(TJnet_Uri.JavaClass.parse(StringToJString('3')));
Intent.setClassName(StringToJString('com.android.settings'), …Run Code Online (Sandbox Code Playgroud) 如何在Delphi XE8 firemonkey多设备项目中将TLabel设置为Bold并恢复到正常运行时?
我试过这个,但它不起作用:
label.TextSettings.Font.Style := [TFontStyle.fsBold];
Run Code Online (Sandbox Code Playgroud)
还尝试过:
label.Font.Style := [TFontStyle.fsBold];
Run Code Online (Sandbox Code Playgroud) 在我的Firemonkey多设备项目中,IDE继续将单元"FireDAC.VCLUI.Wait"添加到我在项目的数据模块中的用途.这个单元阻止我构建项目,因为它无法在Android或iOS中解析名称.奇怪的是,它以前没有这样做,我没有添加/更改任何东西到这个数据模块.
我知道一些组件添加单位的用途,但正如我所说它是一个firemonkey项目而不是一个VCL项目所以它不应该添加这个.
如何防止IDE添加此单元?
而不是通过项目选项使用png图像为splashscreen我想使用我自己的表格用于启动画面.
我在以下链接中找到了XE2的解决方案,但它对Delphi 10 Seattle不起作用:https://stackoverflow.com/a/9080804/2728408
下面我有一些我在项目中尝试过的例子.dpr:
例1:
program Project2;
uses
FMX.Forms,
System.SysUtils,
Unit1 in 'Unit1.pas' {MainForm},
Unit2 in 'Unit2.pas' {SplashForm};
{$R *.res}
begin
Application.Initialize;
SplashForm := TSplashForm.Create(nil);
SplashForm.Show;
Application.ProcessMessages;
Sleep(1000); // Whatever to control display time of splash screen
Application.CreateForm(TMainForm, MainForm);
SplashForm.Close;
SplashForm.Free;
Application.Run;
end.
Run Code Online (Sandbox Code Playgroud)
例2:
program Project2;
uses
FMX.Forms,
System.SysUtils,
Unit1 in 'Unit1.pas' {MainForm},
Unit2 in 'Unit2.pas' {SplashForm};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TSplashForm, SplashForm);
Application.Run;
Sleep(1000);
Application.Terminate;// Also tried Application.Destroy
Application.Initialize;
Application.CreateForm(TMainForm, MainForm);
Application.Run;
end.
Run Code Online (Sandbox Code Playgroud)
例3:
program …Run Code Online (Sandbox Code Playgroud) delphi ×5
firemonkey ×4
android ×1
datamodule ×1
delphi-xe5 ×1
delphi-xe6 ×1
delphi-xe8 ×1
firedac ×1
fonts ×1
gps ×1
ios ×1
mobile ×1
tlabel ×1