Android Tutorial GPS / GNSS tutorial

Status
Not open for further replies.
The GNSS library replaces the old GPS library. The GNSS library is available here: https://www.b4x.com/android/forum/threads/gnss-library-an-updated-gps-library.109110/#content


1741875843450.png


Using it is quite simple:
1. Checking whether location services are available. If not take the user to the settings.
2. Request permission.

If the purpose is to get the user location then the FusedLocationProvider might be a better option: https://www.b4x.com/android/forum/threads/fusedlocationprovider-resolution-dialog.111652/#content
 

Attachments

Last edited:
I assume the original readins are degrees:minutes so try this.
Code:
Dim lon, degmin() As String
Dim evernote As Double
lon = "146:59.30533"
degmin = Regex.Split(":", lon)
If degmin(0) < 1 Then degmin(1) = -degmin(1)
evernote = degmin(0) + degmin(1)/60   
Msgbox(degmin(0) & CRLF & degmin(1),evernote)
 
Last edited:
Using the GPS library I get the following returned:
Lat = -36:3.20404
Lon = 146:59.30533

Now still sitting in the same chair, in Evernote I create a note that records my current GPS as
-36.204040
146.305330

My app creates notes in evernote and I need the same format as Evernotes.
I have read this thread, possibly missed the info I need. But is there a way to convert from one the top pair of Lat Lon to the evernote type pair.

In the Sub GPS_LocationChanged (Location1 As Location) you can get it like this

Code:
dim lat as string
dim lng as string

lng=NumberFormat(Location1.Longitude,0,10)
lat=NumberFormat(Location1.Latitude,0,10)

Set the decimal places to how accurate you want the position ( I put it to 10 decimal places. )
 
GPS - Latitude Ref and Longitude Ref

Hi Erel,

Great tutorial on using GPS. I'm trying to get the Lat and Long Ref values which contain N,E,S,W but don't seem to be able to find them.

Any ideas where i get the settings?

Kind Regards,

Jason
 
Can someone advise on how can I detect when the location has changed a set distance (10 metres for example).

Basically I want the phone to send me an sms/phone me if the location changes and periodically sms me it's location.

Thanks
 
GPS GeolocationDemo & using WebViewExtras

Hi Erel,

I am running the GeolocationDemo and the sample b4a program "WebViewExtrasDemo" is giving below error while compiling the program.

Parsing code. Error
Error parsing program.
Error description: Unknown type: webviewextras
Are you missing a library reference?
Occurred on line: 17
Dim MyWebViewExtras As WebViewExtras

Pls. tell me which library reference need to be add to run this program.
:sign0085:
 
Hi Erel,

Thanks Now I have added WebViewExtras library reference.

I am trying to run sample NinePatchExample and it is giving below error msg.

Parsing code. Error
Error parsing program.
Error description: Unknown type: reflector
Are you missing a library reference?
Occurred on line: 470
Dim r As Reflector


Pls. suggest the library reference for reflector

:sign0085:
 
GPS tutorials and Gps sample program issue

Hi Erel,

I am trying to run a sample b4a program "gps.zip " in "GPS tutorial" but it is not showing any output

Lat =?
Log =?
Speed =?
Satellite=?

I need to develop a android apps for my organization which will getGSMLocation or getGPSPosition of user cell phone and plot the Longitude & Latitudes on Map to track the visits of Sales executive like Google Vehicle tracker utilities.

Kindly guide me to develop the same and suggest related sample programs and tutorials and B4a documentations

Thanks :sign0085:
 
GPS tutorials and Gps sample program issue

Hi Erel,

I am running the GPS program Indoor. The GPS is enabled. The satellite may not be found.

When I searched various sample B4A programs for GPS. I found most of the sample codes in zip format with different dll files (Serial2.dll,GPS.dll) and visual basic modules for windows mobile i.e. "Gps4PPC" Since I am working for android mobile and purchased a license B4A software and I want to develop a apps to implement following tasks for our organization.

[ I ] Location Tracker.
a) Getposition () of user cell phone (Imei Number,longitude & latitude)
b) SetPosition () of user cell phone (Imei number,longitude & latitude)
c) FindDistance() or calculate the distance between two GPS locations.

I need more information and sample B4A (GPS/WiFI/Trangulation) codes to get user/my android mobile cell phone location data like (Device ID, Longitude,Latitude) and I want to save it at one online central Ms Sql database server and pass them to google ("mapnik") map so that it will show the cell locations as a pin points on google map like Google Vehicle tracking system.

Pls. advise me for the same.:sign0085:

Best Regards
Nitin
 
Error In Altitude

The GPS return a bad altitude. This is not a error or bug.
But,
i see a application that return a real altitude, using some as 'with wifi detect'.

Are there some thecnique to get the correct altitude? (or more correct).
--------
El GPS devuelve una altitud erronea. Esto no es un error o fallo.
Pero,
He visto una aplicacion que devuelte la altura real, usando algo como 'detección por wifi'.
¿Hay alguna técnica para objet al altura correcta o al menos, mas correcta?
 
Hello everyone!

I have tested this example on my HTC WildFire S, but it doesn't work as expected. The problem is in speed measurement, it shows me only the fraction of actual speed. For example, on 70 km/h, the app shows only about 15,5 km/h. For comparison, I'm using Navigon which shows correct speed. What went wrong?

Thanks to anyone in advance!
 
i have notice that GPS_LocationChanged function is called each 0,5 second.

is it correct ?

i need done a speed media :)
 
Status
Not open for further replies.
Back
Top