[Sample app] - Visual GPS

335 views
Skip to first unread message

luke x3

unread,
Oct 23, 2014, 10:35:38 PM10/23/14
to androi...@googlegroups.com
Minimalist Visual GPS tracking demo... very much a no-frills version =)
GPSvis.js

Jorge Ramirez

unread,
Oct 24, 2014, 10:24:15 AM10/24/14
to androi...@googlegroups.com
Very nice!

You could improve it with a google map image:


That's an API that returns an image if you give it a center point and a size.

Good job!

luke x3

unread,
Oct 24, 2014, 11:05:46 PM10/24/14
to androi...@googlegroups.com
Ah thanks!
That sounds like a good idea too, I'm guessing the url would go into a createimage(url, xx, xx) call

I thought of using a swipe-style interface to switch between modes, so any/all suggestions are welcome

Vish Seenarain

unread,
Sep 13, 2015, 4:00:49 PM9/13/15
to AndroidScript
Can you post the SPK please?

Thanks ,
vish

Peter de Rooij

unread,
Sep 13, 2015, 4:09:27 PM9/13/15
to AndroidScript
Vish, if you create a new project and replace the code with the content of the .js file it will work.

Steve Garman

unread,
Sep 13, 2015, 4:21:12 PM9/13/15
to AndroidScript
Here Vish, try this.
GPSvis.spk

Vish Seenarain

unread,
Sep 14, 2015, 2:23:14 PM9/14/15
to AndroidScript
No Peter, it doesn't work :(

Peter de Rooij

unread,
Sep 14, 2015, 2:30:16 PM9/14/15
to AndroidScript
Have you tried Steve's SPK. That should work for sure

Vish Seenarain

unread,
Sep 14, 2015, 2:31:12 PM9/14/15
to AndroidScript
Hey Steve, its not working...
Really need that sample. :(

Vish Seenarain

unread,
Sep 14, 2015, 2:32:38 PM9/14/15
to AndroidScript
Message has been deleted

Steve Garman

unread,
Sep 14, 2015, 2:38:16 PM9/14/15
to AndroidScript
Vish, it works here.

What are you expecting from it?

Did you notice that the first words in this thread are

Vish Seenarain

unread,
Sep 14, 2015, 3:59:08 PM9/14/15
to AndroidScript
Steve it doesn't work for me... I just get a black screen. :p
Tried the debugger to see if it was running but in vain.. Its still black..

Timo Octazid

unread,
Sep 15, 2015, 12:59:21 AM9/15/15
to AndroidScript
Hi,
Have your device gps?
If yes, try to go out, it works definitive. At the start the screen is black for some time.

By the way: Nice Example, Steve!

Many Greetings
Timo

Steve Garman

unread,
Sep 15, 2015, 3:09:36 AM9/15/15
to AndroidScript
Timo, I can't take credit for the example.

I just made an spk from Luke's .js file because Vish was having trouble installing it.

I do agree though, it is a nice example.

Vish Seenarain

unread,
Sep 15, 2015, 4:51:07 AM9/15/15
to AndroidScript
Okay thanks everyone. :)
So iT doesn't require an internet connection.

Steve Garman

unread,
Sep 15, 2015, 4:56:21 AM9/15/15
to AndroidScript
No the GPS locator does not require an internet connection.

The network locator does require a connection of some sort.

This code may help you see the difference.

// measure from Charing Cross
var london = {"lat":51.5117, "long":-0.1275};
var gpsS="unknown", netS="unknown";
//Called when application is started.
function OnStart()
{
    //Create a layout with objects vertically centered.
    lay = app.CreateLayout( "linear", "VCenter,FillXY" );    

    //Create a text label and add it to layout.
    txt = app.CreateText( "Waiting...",-1,-1,"MultiLine" );
    lay.AddChild( txt );

    loc1 = app.CreateLocator("GPS");
    loc1.SetOnChange(gps);
    loc1.Start();
    loc2 = app.CreateLocator("network");
    loc2.SetOnChange(network);
    loc2.Start();
    
    //Add layout to app.    
    app.AddLayout( lay );
refresh();
}

function gps()
{
    var dist = loc1.GetDistanceTo(
       london.lat, london.long);
    dist = (dist / 1000).toFixed(2) +" km";
    gpsS = dist;
    refresh();
}

function network()
{
    var dist = loc2.GetDistanceTo(
       london.lat, london.long);
 app.ShowPopup(loc2.GetBearingTo(
     london.lat, london.long));
    dist = (dist / 1000).toFixed(2) +" km";
    netS = dist;
    refresh();
}

function refresh()
{
    var msg = "Straight line distances to London\nGPS:"+
     gpsS+"\nNetwork:"+netS
 
    txt.SetText(msg);
}

Vish Seenarain

unread,
Sep 15, 2015, 5:24:08 AM9/15/15
to AndroidScript
Okay thanks :)

So i might be able to create an offline map?? :p

Vish

Steve Garman

unread,
Sep 15, 2015, 5:35:39 AM9/15/15
to AndroidScript
You could produce a drawn representation of where you have travelled but if you want to relate that to a real-world map, you need to get your maps from somebody else.

That either means storing maps of everywhere you might go on your device or downloading them from the internet as you need them.

If you are intending to try to write something like a cut-down Satellite Navigation System, please be aware that it would be an enormous task (even for an experienced programmer)

Trying to restrict yourself to working offline would make it much more difficult still.

Vish Seenarain

unread,
Sep 15, 2015, 10:16:52 AM9/15/15
to AndroidScript
Isn't it possible to download the map of a particular place like I live in Mauritius and would probably download that. And then navigate through that map (Offline mode).
Reply all
Reply to author
Forward
0 new messages