欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
delphi xe6 調用java GPS的方法
如果用xe6自帶的LocationSensor控件,默認優(yōu)先使用網(wǎng)絡(luò )位置,網(wǎng)絡(luò )位置定位精度不準確,不能滿(mǎn)足高精度定位的要求。但xe6自帶的LocationSensor控件不能指定網(wǎng)絡(luò )定位優(yōu)先還是GPS定位優(yōu)先,如果調用java API是可以指定優(yōu)先使用GPS定位,以下代碼經(jīng)實(shí)測證實(shí)是可以直接指定GPS定位的。
uses Androidapi.JNI.Location, Androidapi.JNIBridge, Androidapi.JNI.JavaTypes, 
  Androidapi.JNI.Os,FMX.Helpers.Android,Androidapi.JNI.GraphicsContentViewText;
type
  TLocationListener = class;
  TForm1 = class(TForm)
  . . . . . .
  private
    { Private declarations }
    FLocationManager : JLocationManager;
    locationListener : TLocationListener;
  public
    destructor Destroy; override;
    { Public declarations }
    procedure onLocationChanged(location: JLocation);
  end;
  //Sensore GPS
  TLocationListener = class(TJavaLocal, JLocationListener)
  private
    [weak]
    FParent : TForm1;
  public
    constructor Create(AParent : TForm1);
    procedure onLocationChanged(location: JLocation); cdecl;
    procedure onProviderDisabled(provider: JString); cdecl;
    procedure onProviderEnabled(provider: JString); cdecl;
    procedure onStatusChanged(provider: JString; status: Integer; extras: JBundle); cdecl;
  end;
. . . . .
constructor TLocationListener.Create(AParent: TForm1);
begin
  inherited Create;
  FParent := AParent;
end;
procedure TLocationListener.onLocationChanged(location: JLocation);
begin
  FParent.onLocationChanged(location);
end;
procedure TLocationListener.onProviderDisabled(provider: JString);
begin
end;
procedure TLocationListener.onProviderEnabled(provider: JString);
begin
end;
procedure TLocationListener.onStatusChanged(provider: JString; status: Integer; extras: JBundle);
begin
end;
destructor TForm1.Destroy;
begin
  if Assigned(locationListener) then
    FLocationManager.removeUpdates(locationListener);
  inherited;
end;
procedure TForm1.onLocationChanged(location: JLocation);//位置發(fā)生變化時(shí),顯示經(jīng)、緯度
begin
  if Assigned(location) then
  begin
     //variabili da recuperare dal sensore
     Label4.Text := location.getLatitude.ToString;
     Label5.Text := location.getLongitude.ToString;
     Label6.Text := location.getAltitude.ToString;
     Label8.Text := location.getSpeed.ToString;
     Label10.Text := location.getTime.ToString;
  end;
end;
procedure TForm1.FormCreate(Sender: TObject);
var LocationManagerService: JObject;
    location : JLocation;
begin 
  if not Assigned(FLocationManager) then
  begin
    LocationManagerService := SharedActivityContext.getSystemService(TJContext.JavaClass.LOCATION_SERVICE);
    FLocationManager := TJLocationManager.Wrap((LocationManagerService as ILocalObject).GetObjectID);
    if not Assigned(locationListener) then locationListener := TLocationListener.Create(self);
    FLocationManager.requestLocationUpdates(TJLocationManager.JavaClass.GPS_PROVIDER, 1000, 0, locationListener, TJLooper.JavaClass.getMainLooper);
      // 監聽(tīng)狀態(tài)
      // 綁定監聽(tīng),有4個(gè)參數
      // 參數1,設備:有GPS_PROVIDER和NETWORK_PROVIDER兩種
      // 參數2,位置信息更新周期,單位毫秒
      // 參數3,位置變化最小距離:當位置距離變化超過(guò)此值時(shí),將更新位置信息
      // 參數4,監聽(tīng)
      // 備注:參數2和3,如果參數3不為0,則以參數3為準;參數3為0,則通過(guò)時(shí)間來(lái)定時(shí)更新;兩者為0,則隨時(shí)刷新
      // 1秒更新一次,或最小位移變化超過(guò)1米更新一次;
      // 注意:此處更新準確度非常低,推薦在service里面啟動(dòng)一個(gè)Thread,在run中sleep(10000);然后執行handler.sendMessage(),更新位置
  end;
 FLocationManager.isProviderEnabled(TJLocationManager.JavaClass.GPS_PROVIDER);
  FLocationManager.isProviderEnabled(TJLocationManager.JavaClass.NETWORK_PROVIDER);
  onLocationChanged(location);
end
本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
Delphi XE Refactor重構功能簡(jiǎn)單說(shuō)明
Delphi XE2 之 FireMonkey 入門(mén)(34)
Delphi XE7 學(xué)習筆記(十五)Android下做登錄窗口
Android 獲取GPS定位信息
TClientDataSet[16]: 用計算字段顯示 UpdateStatus
delphi clipbrd剪貼板的讀寫(xiě)和清除功能
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久