Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8350587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:21:42+00:00 2026-06-09T08:21:42+00:00

I wanna make an app which requires me to get my position and display

  • 0

I wanna make an app which requires me to get my position and display it on google maps. I used the code from http://wiki.phonegap.com/w/page/16494764/PhoneGap%20Geolocation%20Sample%20Application.
I am developing for Android 2.2 using phonegap 2.0.0. I am using the emulator 2.2.

I have installed everything from Phonegap correctly and i obtained a google Api3 key for the map.
I place the key after: http://maps.google.com/maps/api/staticmap?center=(here i place the key). Now when i start the app i use CMD to send coördinates.
Telnet Localhost 5554, geo fix et cetera. When i start the app it will give an error:
Cant retrieve position Error[object PositionError].

I don’t get the error anymore (i added enable HighAccuracy).
But it doesnt show anything either. So i think i did something wrong with the google map or i forgot something.

Could anyone help me? It shows a question mark in the top left corner.

 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html>

     <head>

<meta name="viewport" content="width=device-width; height=device-height; user-scalable=no" />

<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Beer Me</title>
<link rel="stylesheet" href="/master.css" type="text/css" media="screen" />
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8" src="cordova-2.0.0.js"></script>
<script type="text/javascript">

               function loader() {

                    var state = document.readyState;

                    if (state == 'loaded' || state == 'complete') {

                         run();

                    } else {

                         if (navigator.userAgent.indexOf('Browzr') > -1) {

                              setTimeout(run, 250);

                         } else {

                              document.addEventListener('deviceready',run,false);
                         }
                         }
                         }

               function run() {
                   var imageUrl = "http://maps.google.com/maps/api/staticmap?sensor=false&center=" + latitude + ',' + longitude +
                   "&zoom=14&size=300x400&markers=color:blue|label:S|" + latitude + ',' + longitude;
               console.log("imageUrl-" + imageUrl);
               $("#map").remove();
               $(document.body).append(
                   $(document.createElement("img")).attr("src", imageUrl).attr('id', 'map')
               );

                    var fail = function(e) {
                         alert('Can\'t retrieve position.\nError: ' + e);
                    };
                    navigator.geolocation.getCurrentPosition(imageUrl, fail,{ enableHighAccuracy: true });
               } 

          </script>
     </head>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T08:21:43+00:00Added an answer on June 9, 2026 at 8:21 am
    /* enter code here */ function GetCurrentLocation()
                {
                    if (navigator.geolocation) { 
                        navigator.geolocation.getCurrentPosition(function(position) {  
    
                                                                 var point = new google.maps.LatLng(position.coords.latitude, 
                                                                                                    position.coords.longitude);
    
                                                                 // Initialize the Google Maps API v3
                                                                 var map = new google.maps.Map(document.getElementById('map'), {
                                                                                               zoom: 16,
                                                                                               center: point,
                                                                                               mapTypeId: google.maps.MapTypeId.ROADMAP
                                                                                               });
    
                                                                 // Place a marker
                                                                 new google.maps.Marker({
                                                                                        position: point,
                                                                                        map: map
                                                                                        });
                                                                 }); 
                    } 
                    else {
                        alert('W3C Geolocation API is not available');
                    }
                }
    

    Use this code and set sensor = false on

    Hope it will help. Remember that it is not static map.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let say i wanna make a new place in my app (based-on google map
I wanna make a login screen like the one from Facebook's app. The part
i wanna make an array of UIImage in like this view http://i42.tinypic.com/25z1na0.png which i
My app is running recording. If i wanna make 2 page views; 1) record
I wanna make a text editor but its different other text editors.It will get
I wanna make a init method which can understand these contstrutors. candy(name=foo, type=bar) or
I have lots of data in database and I wanna make a statistics from
i wanna make a simple ruby App Engine in rails just like heroku, i'm
How should I go about parsing a url in php? I wanna make it
i've built my first wpf application, nothing fancy, but i wanna make it look

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.