Home > Back-end >  Have nobody XE5 GPS positioning, help ah
Have nobody XE5 GPS positioning, help ah

Time:10-02

Method 1: TLocationSensor
LocationSensor1. Active:=CheckBox1. IsChecked;
Procedure TTfrmEMap. LocationSensor1LocationChanged (Sender: TObject;
Const OldLocation NewLocation: TLocationCoord2D);
The begin
LblJD. Text:=Newlocation. Latitude. ToString.//get longitude
LblWD. Text:=Newlocation. Longitude. ToString.//get dimension
end;
Problem: the message is always no response.

Method 2: procedure TTfrmEMap. Button3Click (Sender: TObject);
Const
LGoogleMapURL: string='https://maps.google.com/maps? Q=% s, % s& The output=embed ';
Var
LocationManagerService: JObject;
Location: JLocation;
FLocationManager: JLocationManager;

Lat: string;
Lon: string;
Alt: string;
The begin
If not assigned (fLocationManager) then
The begin
//get a Java object
LocationManagerService:=sharedActivitycontext getSystemService
(TJcontext. JavaClass. LOCATION_SERVICE);
//get object instances of Java
FLocationManager:=tjlocationmanager. Wrap the
((LocationManagerService as ILocalObject). GetObjectID);
end;

//use the GPS provider to get the current lat, long and led
Location:=fLocationManager getLastKnownLocation
(tjlocationmanager. JavaClass. GPS_PROVIDER);
If Location<> Nil then
The begin
Lat:=format (' % 2.6 f, [location. GetLatitude]);
Lon:=format (' % 2.6 f, [location. GetLongitude]);
Alt=format (' % 2.6 f, [location. GetAltitude]);
LblJD. Text:=lat;
LblWD. Text:=lon;
WebBrowser. Navigate (Format (LGoogleMapURL, [Lat, Lon]));
End
end;
The Location problem is always nil
One done, under the correct help!

CodePudding user response:

Rookie across ~ ~ ~ ~

CodePudding user response:

Use GOOGLE maps?

CodePudding user response:

Help the roof floats through the OK to release the source code

CodePudding user response:

Call the method that the android native GPS see: http://www.cnblogs.com/qiufeng2014/p/3698926.html

CodePudding user response:

Also can refer to this article: http://www.cnblogs.com/qiufeng2014/p/3817681.html
  • Related