Jerry Levine
Posts: 0
Joined: Tue Oct 09, 2012 6:16 am

Geolocation to Picking Location

Hiya...

This may be out of the scope of the forum, but...I hope someone can help!

Basically, what I want to do (and not display a map, although I suppose it can be hidden) is the following:

1) Geolocate user
2) Based on user's location, display a specific item - essentially, "I think you are here - is that correct?"
3) Upon press of Yes, go to a specific webpage
4) If No, present selections of other locations and then go to their webpage.

I can figure out (4) - it's just a list. But I kind of need help with 1-3...

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Geolocation to Picking Location

1) You can try to use this code:

initiate_geolocation();
function initiate_geolocation() {
navigator.geolocation.getCurrentPosition(handle_geolocation_query,handle_errors);
}
function handle_errors(error)
{
switch(error.code)
{
case error.PERMISSION_DENIED: alert("GPS function not available right now");
break;
case error.POSITION_UNAVAILABLE: alert("Location services not turned on! Please enable location services prior to continuing.");
break;
case error.TIMEOUT: alert("retrieving position timed out");
break;
default: alert("unknown error");
break;
}
}
function handle_geolocation_query(position){
alert('Lat: ' + position.coords.latitude +
' Lon: ' + position.coords.longitude);
}

2) Use $(document).simpledialog( to call the dialog - this shoul help http://dev.jtsage.com/jQM-SimpleDialo...

3) You can add events on click "Yes" button (here is more information http://stackoverflow.com/questions/50...)

Jerry Levine
Posts: 0
Joined: Tue Oct 09, 2012 6:16 am

Geolocation to Picking Location

Marina -

Thanks. With regard to (1), I'm presuming that goes in the Custom Javascript field, and I could call that at Load?

Thanks,

Jerry

Jerry Levine
Posts: 0
Joined: Tue Oct 09, 2012 6:16 am

Geolocation to Picking Location

Solved, the answer is yes, of course.

Jerry Levine
Posts: 0
Joined: Tue Oct 09, 2012 6:16 am

Geolocation to Picking Location

Marina - I think that this might be a function of my limited programming knowledge. I might just need to find someone to do this for me.

Tiggzi seems to be simple, but I just don't know how to effectively use code to do things that are out of the realm of the main interface. :(

Jerry Levine
Posts: 0
Joined: Tue Oct 09, 2012 6:16 am

Geolocation to Picking Location

This is just a function of me quitting CS to go to business school. Now recognized as a bad decision. :)

I can visualize what's supposed to happen - , I can tell that it's determine location lat/long, request ZIP based on lat/long, look at array for matching ZIP code, display specific location based on array, else, offer list based on state/locations...

I just don't know what the heck I'm doing. Hah.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Geolocation to Picking Location

To work with Tiggzi you should have some knowledges of HTML, JS, CSS, but don't be frustrated! Did you try sample above? What exactly doesn't work?

Puneet Duseja
Posts: 0
Joined: Wed Apr 16, 2014 10:55 am

Geolocation to Picking Location

Hi,
I would like to know if i can display the user location on my app screen, using the above mentioned java script.

copyin here as well...
initiate_geolocation();
function initiate_geolocation() {
navigator.geolocation.getCurrentPosition(handle_geolocation_query,handle_errors);
}
function handle_errors(error)
{
switch(error.code)
{
case error.PERMISSION_DENIED: alert("GPS function not available right now");
break;
case error.POSITION_UNAVAILABLE: alert("Location services not turned on! Please enable location services prior to continuing.");
break;
case error.TIMEOUT: alert("retrieving position timed out");
break;
default: alert("unknown error");
break;
}
}
function handle_geolocation_query(position){
alert('Lat: ' + position.coords.latitude +
' Lon: ' + position.coords.longitude);
}

Thanks

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Geolocation to Picking Location

Hello!

Have you tried this code? Are there any problems?

Puneet Duseja
Posts: 0
Joined: Wed Apr 16, 2014 10:55 am

Geolocation to Picking Location

Hi, I tried this code and it works fine, as it displays the latitude and longitude. I want to know the name of the location or city and display it in a field on the application. Could you please let me know how that can be achieved. Thanks!

Return to “Issues”