1.04
anywheresoftware.b4a.gps.LocationWrapper
Location
A Location object holds various information about a specific GPS fix.
In most cases you will work with locations that are passed to the GPS LocationChanged event.
The location object can also be used to calculate distance and bearing to other locations.
android.location.Location
process
Initialize
Initializes an empty location object.
void
ConvertToSeconds
Converts the given coordinate to a string formatted with the following format:
[+-]DDD:MM:SS.SSSSS (Minute = 1 / 60 of a degree, Second = 1 / 3600 of a degree)
java.lang.String
Coordinate
double
DistanceTo
Returns the distance to the given location, measured in meters.
float
TargetLocation
android.location.Location
ConvertToMinutes
Converts the given coordinate to a string formatted with the following format:
[+-]DDD:MM.MMMMM (Minute = 1 / 60 of a degree)
java.lang.String
Coordinate
double
Initialize2
Initializes the location object with the given Latitude and Longitude.
Values can be formatted in any of the three formats:
Degrees: [+-]DDD.DDDDD
Minutes: [+-]DDD:MM.MMMMM (Minute = 1 / 60 of a degree)
Seconds: [+-]DDD:MM:SS.SSSSS (Second = 1 / 3600 of a degree)
Example:<code>
Dim L1 As Location
L1.Initialize2("45:30:30", "45:20:15")</code>
void
Latitude
java.lang.String
Longitude
java.lang.String
IsInitialized
boolean
BearingTo
Returns the bearing to the given location.
float
TargetLocation
android.location.Location
AltitudeValid
boolean
Returns true if the fix includes altitude value.
Accuracy
float
value
float
Gets or sets the fix accuracy (meters).
BearingValid
boolean
Returns true if the fix includes bearing value.
SpeedValid
boolean
Returns true if the fix includes speed value.
Altitude
double
value
double
Gets or sets the fix altitude (meters).
Speed
float
value
float
Gets or sets the fix speed (meters / second).
Time
long
value
long
Gets or sets the fix time.
Latitude
double
value
double
Gets or sets the fix latitude (degrees from -90 (South) to 90 (North)).
Longitude
double
value
double
Gets or sets the fix longitude (degrees from -180 to 180, positive values represent the eastern hemisphere).
AccuracyValid
boolean
Returns true if the fix includes accuracy value.
Bearing
float
value
float
Gets or sets the fix bearing East of true North.
anywheresoftware.b4a.gps.GpsSatelliteWrapper
GPSSatellite
The GPSSatellite object holds various information about a GPS satellite. A List with the available satellites is passed to the GpsStatus event.
android.location.GpsSatellite
process
IsInitialized
boolean
UsedInFix
boolean
Tests whether this satellite was used to calculate the most recent fix.
Prn
int
Returns the PRN (pseudo-random number) for the satellite.
Elevation
float
Returns the satellite elevation in degrees (0 - 90).
Azimuth
float
Returns the satellite azimuth in degrees (0 - 360).
Snr
float
Returns the signal to noise ratio for the satellite.
anywheresoftware.b4a.gps.GPS
GPS
The main object that raises the GPS events.
Note that this library requires Android 2.0 or above.
process
LocationChanged (Location1 As Location)
UserEnabled (Enabled As Boolean)
GpsStatus (Satellites As List)
NMEA (TimeStamp As Long, Sentence As String)
android.permission.ACCESS_FINE_LOCATION
Initialize
void
EventName
java.lang.String
Start
Starts listening for events.
MinimumTime - The shortest period (measured in milliseconds) between events. Pass 0 for highest frequency.
MinimumDistance - The shortest change in distance (measured in meters) for which to raise events. Pass 0 for highest frequency.
void
ba
anywheresoftware.b4a.BA
MinimumTime
long
MinimumDistance
float
Stop
Stops listening to the GPS. You will usually want to call Stop inside Sub Activity_Pause.
void
IsInitialized
boolean
GPSEnabled
boolean
Tests whether the user has enabled the GPS.
LocationSettingsIntent
android.content.Intent
Returns the intent that is used to show the global locations settings.
Example:<code>
If GPS1.GPSEnabled = False Then StartActivity(GPS1.LocationSettingsIntent)</code>
1.2
The GPS library allows you to get information from the phone's GPS device.
See the <link>GPS tutorial|http://www.basic4ppc.com/forum/basic4android-getting-started-tutorials/6592-gps-tutorial.html</link> for more information about this library.