Share My Creation GPS Example

alfcen

Well-Known Member
Licensed User
Longtime User
Hallo Klaus,

Without the latest IDE 1.8, I would not have found the undeclared variables, in that the credit goes to Anywhere Software's B4A. The latest B4A IDE is awesome, indeed.

I do appreciate very much that you took everything in best faith.

Are you still developing such hi-grade applications with the emulator only?
This is amazing!

Cordialement
Robert
 

Andras

Active Member
Licensed User
Longtime User
I seem to be having a problem with the program; after installing it on my phone to see how it actually 'works' in the real world, I find that the map never updates, regardless of the latitude and longitude co-ordinates given, and regardless of where I actually am.

It picks up the satellites wonderfully well, but seems to do nothing with that data. Also on closing the program the GPS function remains active on the phone, whereas I'd expect it to close.

I'm clearly missing something here, but what?

John
 

klaus

Expert
Licensed User
Longtime User
Are you still developing such hi-grade applications with the emulator only?
No, I have a Nexus One device. But I'm still using the emulator a lot for the layouts.
I've got a new computer and the emulator is much faster than before.

I find that the map never updates, regardless of the latitude and longitude co-ordinates given, and regardless of where I actually am.
Have you checked in the Setup 'GPS Show GPS on map' ? If not the map will not be updated.
You should also check: 'Save GPS path' and 'Draw GPS path'.
You can also set default coordinates for the map in the setup. The map will be centered at that location by default. You can also set the default zoom level.
Also on closing the program the GPS function remains active on the phone, whereas I'd expect it to close.
I checked in the code that GPS1.Stop is really called: OK.
I then checked on my decive and the GPS is stopped after leaving the program. Sometimes it's not immediate.

Best regards.
 

Andras

Active Member
Licensed User
Longtime User
Thanks Klaus, that's very helpful and I've now got it to recognise my location at least; but whatever lat. and long. I type in as the default co-ordinates are ignored. Shouldn't the program jump to those automatically when it starts?
 

klaus

Expert
Licensed User
Longtime User
Hi Andras,
I apologize, you were rigth. There was a problem with the map display not centered on the default coordinates.
The zip file in the first post is updated, version 1.60.

Did you know that the program is explained in the Beginner's Guide ?

Best regards.
 
Last edited:

Andras

Active Member
Licensed User
Longtime User
Thanks, Klaus - I'll try it out again! Most grateful for the help!

Yes, I know about the explanation; I'm going to try working through the program to see exactly how it works. I must say that the more I use B4A, the more I like it!

John
 

Andras

Active Member
Licensed User
Longtime User
Actually, Klaus, I'm still getting the same result with the new version; Lat. 51.48376, Long. -3.18333 should give me Cardiff Castle, chosen because it should be easily recognisable; it's actually giving me the Autoroute Suisse and its environs, though I haven't bothered to work out exactly which town I'm in.

Your home town, perhaps?

John
 

latcc

Banned
Klaus

I would like to use this example to create an air navigation map for cross-country paragliding. The only problem is that in the UK we are not allowed by law to have a phone device working in the air. (Due to the phone mast triangulation system being overloaded when the phone picks up a wide range of masts at the same time.)

So using google maps downloaded by phone is not legal or possible (phones don't work properly when you are flying above 500 feet.

Is there any way, with your superb example, that I can use a moving map graphic that is already present on the device, rather than having to download it via the phone connection?
 

klaus

Expert
Licensed User
Longtime User
Is there any way, with your superb example, that I can use a moving map graphic that is already present on the device, rather than having to download it via the phone connection?
Yes, it is possible, but you need to write the whole map management and you need to calibrate the map. It could be done with a big bitmap and drawing the relevant portion on the screen, or having a big Panel and moving it. Or having calibrated tiles that could loaded and drawn on the screen. There could be a memory proplem depending on the bitmap size.
Is GPS allowed in the conditions you describe?

Best regards.
 

latcc

Banned
Hi Klaus

Yes, GPS is allowed in flight. I have been flying with GPS apps for a long time. I was wondering if I could download the google tiles I might need in any flight and somehow store them and retrieve them as needed from memory, rather than downloading them from the internet. That would be the simplest way to change your code. Have you any suggestions how I might read these google map tiles from the phone rather than the internet?
 

hdtvirl

Active Member
Licensed User
Longtime User
Klaus, I would just like to add my "Thanks" also to you for sharing this example with us, this is the way all Android Apps should be written and I for one will use this as my benchmark for any apps I write from here on in, the whole package is just perfect. I was only looking for an example of using scrollviews in a more user friendly way and now I have a Best Practices example for B4A not just for scrollviews.

My app is very boring in comparison as all it does is present figures in a scroll view and Barcharts.

Once again Thank you.


Regards

hdtvirl.
 

TomDuncan

Active Member
Licensed User
Longtime User
I am having the same problem with the map not being positioned for me in Australia. I have gps selected gps, maps and in setup have markers and polyline unchecked.
I get a europe map with a down facing green arrow.
It is a bit strange but it has worked for me once. Now refuses to on both an HTC Desire and Motorola Xoom.
Tom
 

JMoore

New Member
Licensed User
Longtime User
Hi
I have been trying to get the GPS example started but get the following errors

Compiling code. Error
Error parsing program.
Error description: Unknown type: webviewextras
Are you missing a library reference?
Occurred on line: 138
Dim MapViewerExtra As WebViewExtras
 

klaus

Expert
Licensed User
Longtime User
As the error message explains it, you are missing the WebViewExtras library.
You can download it here.
You must copy the jar and xml files to your additional libraries folder.
Then you should see the library in the Libs Tab in the lower right corner of the IDE and check it.
For more information on additional libraries you could read chapters 4.3.4, 18.1 and 18.2 in the Beginner's Guide.

Best regards,
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…