Share My Creation GPS Example

BarrySumpter

Active Member
Licensed User
Longtime User
Very nice Klaus!

An absolute treasure trove of info.

Love your work man!

----

Just some thoughts as how I would enhance this app.
May already be there.
Not asking anyone to do it.
But may do it meself if I get the urge.

----

Change input default location of Lng then Lat
to Lat then Lng

----

Add button to set default location to current GPS location.

----

Add button to set default location to current map centre.

----

Rename scale control to Scale Legend.

----

When exiting the setup don't reposition map to default location.

----

Add a setting to display zoom level as well. Like speed.

----

Add a setting to start at current GPS location and not default location.

----

Add a zoom level control.

----

Change zoom button to be transparent like icons.

----


Realy nice work, man.
Wow. Big WOW.
 
Last edited:

klaus

Expert
Licensed User
Longtime User
I'm glad that you find the program useful .

Your points:

Change input default location of Lng then Lat to Lat then Lng
No problem, it's just a move in the layout.

Add button to set default location to current GPS location.
Not difficult, add a button and a routine.

Add button to set default location to current map centre.
Not difficult, add a button and a routine.

Rename scale control to Scale Legend.
Controls is meant for the choice of the displayed map Scale, Type and Zoom controls.
The position is perhaps not the best one but saved some space, should have been on top of the three controls.
Can easily be changed in the layout.

When exiting the setup don't reposition map to default location.
Can be done in Activity_Resume of the Main module in changing the MapCenter values.

Add a setting to display zoom level as well. Like speed.
I didn't find the need for it. But could be added.

Add a setting to start at current GPS location and not default location.
When the GPS is activated the map is shown at the default location but as soon as the first location is found the map is centered on that location.
Could be changed in the btnGPS_Touch routine in the Main routine, but then you need to define what other position you want to show.

Add a zoom level control.
Already exists, it's display can be selected in the setup.

Change zoom button to be transparent like icons.
The zoom control is the internal control of Google Maps.
In my first version when I didn't know how to trap the zoom change in Google Maps I used a transparent 'home made' one. But then prefered to use the 'standard' one.

Feel free to change the program to your needs and wishes, thats the purpose of this example. If you have any problem please ask.

Best regards.
 

BarrySumpter

Active Member
Licensed User
Longtime User
Thanks for the reply and the suggestions klaus.
Love the easy and not diffucults.

I might be getting the scale control that doesn't show on my HD2 mixed up with the scale legend.

Zoom control is the + and - buttons.

I don't know the zoom levels.
So displaying them would be useful to me anyway.
Zoom levels are 1 to 20.
1 being farthest away.
20 being street level.

I'm not sure what first location is as different to other position.

Yes, was thinking the app should let google do absolutely everything then b4a extracts the values it needs.

Thank for permission to modify the example.

Any restrictions on distributions?

I've written before that I'm not trying to sell anything at all.
Been there. Done that. Major fail.

Just want to develop things for my family and friends.

I've got a google static maps kinda app that allows my bike riding buddies to find each other with kickoff points or coffee shops.

But that apps language isn't mature enough to work with extracting info from google live maps via javascript behind webviews.

And just found out the features I need are not going to be available anytime soon. So have decided to drop them again and focus solely on b4a.

So I'd like ot start with your example and enhance from there.
And use myself with my bike riding buddies n family n frieds.
Again, not interested in wasting time trying to sell anything.
Could I get your permission to do that?

Thanks again and all my best,
Barry G. Sumpter
 
Last edited:

BarrySumpter

Active Member
Licensed User
Longtime User
Super-fast alternative to emulator -> x86 Android

I was just thinking the regular Android emulator was slow.

Especially on my computer with the Setup Panel having so many views (controls).

And found this excellent contribution from another billiant contributor.

Super-fast alternative to emulator -> x86 Android
http://www.b4x.com/forum/basic4andr...er-fast-alternative-emulator-x86-android.html

Very nice!

I was thinking this an appropriate place for mentioning this as developers who are editing the setup panel might appreciate it.
 
Last edited:

BarrySumpter

Active Member
Licensed User
Longtime User
Need to update my list of enhancements:

Since I've been turning OFF the repositioning of the map to Default Lat n Lng
(usually happens after each button press)
I need to add a way to reposition to default lat n lng with another button.

Also, I was thinking I've seen other maps that hide all button on the map.
Then when the map is touched in any way to have them reappear for say 3 seconds.
Then fade out/dissapear again.

One map has a compass icon button in the top right corner to reposition.
But I think this one changes the orientation as well.

Another map has a pin icon button in the lower left to reposition.

I don't know which would be most appropriate.

Also, I really like Google Maps Sonar Bubble indicator for current position.
I wonder if anyone on b4a has developed this?

I've attached some compass icons.

Thank of course I'm wondering if Google Maps would do ALL this for us bysetting up ALL the right parameters via google.maps.api html.
As in getting Google Maps to do absolutely everything it can.
i.e. define scale buttons, scale legend, Bubble Sonar, etc

Then having b4a wrap it n pull out the right properties, etc.
 

Attachments

  • GPSCentreCurrLocIcons.zip
    13.1 KB · Views: 471
Last edited:

BarrySumpter

Active Member
Licensed User
Longtime User
Hi Klaus,
I wanted to save an updated version of your GPSExample as GPSBGSExample and b4a.gpsbgsexample and get this error on compile:

B4X:
Compiling code.                         0.23
Compiling layouts code.                 0.02
Generating R file.                      0.00
Compiling generated Java code.          Error
javac 1.7.0_03
src\b4a\gpsexample\main.java:382: error: cannot find symbol
public satellites _satellites = null;
       ^
  symbol:   class satellites
  location: class main
1 error
----

The java error: "cannot find symbol" occurred when a Compiler does not recognize a class name.

The following are the reason for such an error -
1)When a programmer misspelled the name of the class.
2When a programmer does not Imported the class name.

-----

The original GPSExample download again and without changes compiles and executes without errors.

-----

I've downloaded and edited the original GPSExample yet again
Project | package name
original: B4A.GPSExample - where I thought caps were illegal
changed to: com.bgs.gpsexample - compiles but errors on phone
Absolutely the only change I've made.

-----

Any help would be greatly appreciated.
 
Last edited:

klaus

Expert
Licensed User
Longtime User
Hi Barry,
I get the same result.
I also, copied the original project in a new folder and changed the package name, same result.
I tried different other things without success.

The only advice I could give is to copy the project but not change the package name, it works with B4A V1.9 even with a package name with upper case characters as long as we don't change them.

Best regards.
 

BarrySumpter

Active Member
Licensed User
Longtime User
Thanks klaus,
Good to know its not just me and my environment.

If I change the package name to a 3 words like x.y.z
I don't get the compile error.

But on execution I get

B4X:
An error has occured in sub: 
gpsmobile_loadpath (java line:31) 
java.lang.ClassNotFoundException: B4A.GPSExample.main$_gpslocation
Continue?
which suggests to me that somehow the package name is NOT getting changed.
Or that somewhere the package name is hardcoded.


Maybe NJDude or Erel will post a suggestion?
 
Last edited:

BarrySumpter

Active Member
Licensed User
Longtime User
Hi Klaus,

Does the original GPSSample track current location by changing maps?

I zoom to 17 and the map won't scroll to keep my current location visible.

Is there a way to track and keep my current location visible in the centre of the screen?
 

hansje

New Member
Licensed User
Longtime User
Thanks klaus,

I am trying to run jour app.
I am using a htc sensation and android version 4.0.3.
When i select the map-button the program is stopt.
(message "GPSExample stoped")
idem is i save a path.

any idear what i am doing wrong?

Greetings Hans
 

BarrySumpter

Active Member
Licensed User
Longtime User

Continue? Yes


B4X:
An error has occured in sub: 
main_activity_resume((java line:595) 
java.lang.RuntimeException: Object should first be initialized (ImageView)
Continue?
B4X:
 An error has occured in sub: 
 main_activity_resume((java line:2049) 
 java.lang.RuntimeException: Object should first be initialized (Panel)
 Continue?
1042

I've also tried to recreate from scratch but no go.

I'd like to recover my work without having to piecemeal it back together.
Is there a way to change the package name back to B4A.GPSExample somehow behind the scenes.

Like editing a jar file etc?

Anyone?

:sign0085:

Was able to retrive my work with help from NJDude.
Backed up my entire project.
Edited the problem .b4a file with a text editor.
And change to the following line:
from:
Package=b4a.gpsexample

back to:
Package=B4A.GPSExample

Working again now.
But can't have the original project installed and the updated project installed at the same time.
Bummer.
 
Last edited:

BarrySumpter

Active Member
Licensed User
Longtime User
Wanted to post my updates to GPSExample:

My updates in Bold.

In the second image attached.
The Visual Designer shows the background panel between the forground panels.
I can mouse down on the background panel
then drag the background panel up and down to get to the offscreen forground panels.
I've added code to remove the gap between forground panels when executing.

hth
 

Attachments

  • screenshot-1336692838931.png
    85.9 KB · Views: 406
  • Virtual Designer Setup Layout.png
    80.9 KB · Views: 407
Last edited:

jparkerri

Member
Licensed User
Longtime User
Has drawing Path on map been added by anyone?

Has the ability to leave a trail of the GPS positions on the map been added?
Also, how would I add a fixed KML file of a grid of lines to the Map? I'm trying to setup the GPS Example as a data logger while I steer a boat over a ladder style grid of transect lines. I need to see the lines (the KML above) and my trail so I know how well I'm following the lines and where I've already been.
Thanks. I love the program as it is.
 

klaus

Expert
Licensed User
Longtime User
Has the ability to leave a trail of the GPS positions on the map been added?
Yes, since the first version. You must check the function in the setup and when GPS is running the GPS path is shown on the map and can be saved as GPP file (proprietary file format) or as a KML file.

You can read GGP files, but only one at the same time. There is no function to read KML files.

But feel free to adapt the program to your needs.

Best regards.
 

hansje

New Member
Licensed User
Longtime User
Hi Hans,
Sorry, but I don't know what the problem is.
Can you run the program in Debug mode from the IDE and look at the Log message to see what caused the error.

Best regards.

Thanks Klaus,

I am new in the world of basic4android.
So i can not tell whats wrong here.
Maybe you can.
This is my log.

LogCat connected to: fone hans
--------- beginning of /dev/log/system


--------- beginning of /dev/log/main
** Activity (main) Create, isFirst = true **


** Activity (main) Resume **


** Activity (main) Pause, UserClosed = false **


** Activity (satellites) Create, isFirst = true **


** Activity (satellites) Resume **


** Activity (satellites) Pause, UserClosed = true **


** Activity (main) Resume **


** Activity (main) Pause, UserClosed = false **


** Activity (setup) Create, isFirst = true **


** Activity (setup) Resume **


** Activity (setup) Pause, UserClosed = true **


** Activity (main) Resume **


java.lang.RuntimeException: MotionEvent { action=ACTION_UP, id[0]=0, x[0]=231.1976, y[0]=922.0107, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=146898380, downTime=146898231, deviceId=4, source=0x1002 } recycled twice!


at android.view.MotionEvent.recycle(MotionEvent.java:1659)
at android.view.ViewRootImpl.finishMotionEvent(ViewRootImpl.java:2977)
at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:2968)
at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2522)
at android.view.ViewRootImpl.processInputEvents(ViewRootImpl.java:862)
at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2531)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:4944)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)


at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)

I hope jou can make sense of this

Greetings Hans
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…