Share My Creation GPS Example

wm.chatman

Well-Known Member
Licensed User
Longtime User
Great job Klaus and works a Treat !! :sign0188:

Thank you so much.

Best regards,
William
 

gregwa

Member
Licensed User
Longtime User
Invalid Double - loc.Altitude

I tried searching the thread just in case someone had already posted this, but couldn't find anything.

In the sub GPS1_LocationChanged, I was getting an Invalid Double error when the code was trying to set:
B4X:
loc.Altitude = NumberFormat(Location1.Altitude, 1, 1)

It seems that being "Rocky Mountain High" is causing this to go into the bananas range. The value that is attempting to put into the double is "1,717.29". Of course this throws the error.

I "fixed" it by simply setting it this way:

B4X:
loc.Altitude = Location1.Altitude

Not sure of any ramifications yet, but I'll test it out.

Really nice program.

Gregwa
 

klaus

Expert
Licensed User
Longtime User
Hi Gregwa,

Thank you for reporting this error.

Anyway Setting a number with:
loc.Altitude = NumberFormat(Location1.Altitude, 1, 1)
is bad programming practice because NumberFormat returns a String and not a number.

Everywhere for numbers I replaced it by
loc.Altitude = Round2(Location1.Altitude, 1)
and for the others I replaced them with NumberFormat2 lines.

The source code in the first post has been updated.

Best regards.
 

gregwa

Member
Licensed User
Longtime User
Glad I was able to help.

I know there aren't many people living "at altitude" so I'm sure that's why it didn't get caught before. There's not much O2 here ;o)
 

klaus

Expert
Licensed User
Longtime User
I'm also living in a mountain country but I have never tested the program above an altitude of 1000m .
I could have been at an altitude heigher than that in less than a quarter of an hour driving. But unfortunately I tested it only in the valley.

Best regards.
 

gregwa

Member
Licensed User
Longtime User
Well, as we say here, "Who would have thunk it?"
 

johnaaronrose

Active Member
Licensed User
Longtime User
Noobie queries


I'm considering amending your app to use a .jpg file (instead of .gpp) which is a scan of part of a British Ordnance Survey map (better resolution than Google Maps). I like the idea of having a big Panel containing the .jpg file contents & moving it. Could you direct me to the place where the existing .gpp test maps are displayed on the screen?
PS I downloaded some Google Map tiles on my phone (i.e. download for offline) but I can't find the place where Google Maps stores them. Which folder does it use? Alternatively, is there a way of making Google Maps (on a desktop using the Browser) download them?
 

klaus

Expert
Licensed User
Longtime User
The map is diplayed in the MapViewer WebView with the MapDisp routine.
All the scrolling is managed internally in the WebView.

If you want to use an image you must rewrite display part of the program using for example a ScrollView2D object.
You will also need to include the scaling of the map image.

I don't know where Google saves the map tiles, I have never worked with local map tiles.

You should also have a look at the OSMDroid - MapView for B4A tutorial.
The GPSExample was written before OSMDroid was available.

Best regards.
 
Last edited:

johnaaronrose

Active Member
Licensed User
Longtime User
Thanks


Thanks, Klaus, for the info. I've considerably amended your app to load a .jpg map & I've removed coding concerning (e.g.) zoom from the setup (i.e. Setup.txt) file. This now gives a problem so I need to amend the file. But I can't find it now: I thought that it would be in the Files folder but it's not there. Could you post a copy of it?
 

klaus

Expert
Licensed User
Longtime User
I don't have a file for this.
The program looks if the exists, if yes it is loaded, if no default parameters are used and the file is created the first time Sub Activity_Pause is called.
You should delete the existing file and leave the program create a new one.

Best regards.
 

johnaaronrose

Active Member
Licensed User
Longtime User
Ref to B4A.GPSExample


Thanks Klaus for the info. I've been trying to find the existing Setup.txt file without success: I've only just realised that Dir.Internal files do not show up using Astro / ES File Explorer as only the app that created them is allowed access to them: rather different to what I expect from Linux distros!

I've just changed the Package Name on your app that I've now butchered. I've also changed the Application Label (in Module Attributes of the .B4A file). I now get a problem in GPSModule (in the LoadPath Sub) on line "Main.GPSPath.Initialize". It has a Class Not Found Exception of "B4A.GPSExample.main$_gpslocation". Could this be due to the gpsmodule.java file containing the line "public static String _loadpath(anywheresoftware.b4a.BA _ba) throws Exception{
Debug.PushSubsStack("LoadPath (gpsmodule) ","gpsmodule",5,_ba,mostCurrent)"? I presume that the above ref to "B4A.GPSExample" originates from somewhere (either in the B4A file or one of the Project parameters) though I can't find it in any of the .java files. Could you tell me where it comes from?

PS I've attached the app's .zip file.
 

Attachments

  • OSMapGPS.zip
    132.9 KB · Views: 442
Last edited:

johnaaronrose

Active Member
Licensed User
Longtime User
How to examine .class & .dex files?

B4A.GPSExample was the previous package name.
I remember that there were problems in previous versions with package names having upper case characters.
You should set the package name back to B4A.GPSExample.

Best regards.

The previous package name of B4A.GPSExample must be somewhere in one of the files included in the attached OSMapGPS.zip file: B4A cannot remember it from a previous version of one of the files. I have looked at all of the files except for the .class & .dex files. However, I am not able to open them with a program so that I can look at them. What program can be used to look at these files?
 

Attachments

  • OSMapGPS.zip
    132.9 KB · Views: 395

johnaaronrose

Active Member
Licensed User
Longtime User
Fixed Class exception problem

I've fixed the Fixed Class exception problem: I think it was due to the phone ending up with 2 versions of the app. I'm now trying to figure out the use of the GPSPathFilename variable in conjunction with the test1.gpp file & its reading in the app. Is the test1.gpp file & the setting of the GPSPathFilename variable to it required in the app? In other words, does the test1.gpp file contain data for your location and should the variable be set to ""?
 

wm.chatman

Well-Known Member
Licensed User
Longtime User
Hello Klaus,

It has been a few years now since I have been here, and I want to say HELLO. I am back
Does you GPS Example have a Track back function ? I really need that, would like to find my Jeep again.
Is it possible for you to maybe integrate this function, or maybe at least set Waypoints, so I would be able to track back?

Regards to you,
William
 

klaus

Expert
Licensed User
Longtime User
Hi William,

Does you GPS Example have a Track back function ?
No, there is no track back function.
The GPS Example is a relatively 'old' project.
I have currently several projects in my pipeline and don't want to spend time on it.
Implementing a Track back function would need quite some time.
 

wm.chatman

Well-Known Member
Licensed User
Longtime User
old project or not it is very useable.
Your pipeline might be overloaded, but could you maybe think it over again, for me.
I really need a Waypoint function for Tracking back to Vehicle.
I would be willing to donate, for the time and headaches.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…