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 6612265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:04:37+00:00 2026-05-25T20:04:37+00:00

i am just trying to get practiced with phone gap for android devices. I

  • 0

i am just trying to get practiced with phone gap for android devices. I found an map based app here

Following is the javascript i tried to run

<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="scripts/phonegap.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 win = function(position) {                          // Grab coordinates object from the Position object passed into success callback.
                         var coords = position.coords;
                         var url = "http://maps.google.com/maps/api/staticmap?center=" + coords.latitude + "," + coords.longitude + "&zoom=13&size=320x480&maptype=roadmap&key=xxxxxxxxxxxxxxxxxxx&sensor=true";
                         document.getElementById('map').setAttribute('src',url);
                    };
                    var fail = function(e) 
                    {
                         alert('Can\'t retrieve position.\nError: ' + e);
                    };
                    navigator.geolocation.getCurrentPosition(win, fail);
               } 
          </script>
     </head>
     <body onload="loader();">
          <img id="map" />
     </body>
</html>

when i run in the android device it shows an alert box that Can\'t retrieve position.
The function for Position is not been called. How to get the position of a place in phone gap javascript, please help me….

  • 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-05-25T20:04:38+00:00Added an answer on May 25, 2026 at 8:04 pm

    Well, if you are talking about that exact code, it looks like it wants a key for google maps. That tutorial is a year old which is ancient in google map time.

    If you are willing to move to Google Maps JavaScript v3 (non-static – no key, much more powerful and interesting to use than static maps), here’s a gettting-started google map route finder tutorial. It’s also from the phonegap wiki pages, see android tutorials, scroll down to the one titled jQuery Google Maps Plugin for Google Maps v3: Route Finder App.

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

Sidebar

Related Questions

I am just trying to get into python, but I've found it very difficult
I am trying to create a reddit app (just for practice) for Windows Phone
Just trying to get my head around Generics by reading this enlightening article by
Just trying to get my irb sessions to actually list the current line of
Just trying to get up to speed with the SDK... So, I've created my
Just trying to get my head round Spring and figuring out how I wire
Just trying to get diff to work better for certain kinds of documents. With
Just trying to get my head around what can happen when things go wrong
I'm just trying to get a general idea of what views are used for
I'm just trying to get MySQL to store time in GMT... I've read the

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.