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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:10:59+00:00 2026-05-20T22:10:59+00:00

I have a web app that displays a web page in a web view.

  • 0

I have a web app that displays a web page in a web view. But the web page can’t pick up the getcurrentposition, however if i display the web page in the android broswer it does , but not in the web app?

When the page is run from a web app, it gets to the ‘here’ alert in the js below and
when the page is displayed the map is displayed with
“Error: The Geolocation service failed.”

Has anyone written a native web app, that can pick up geolocation? There must be something else needed in the java web app or permissions. has anyone done this..

here is the html i’m trying to use the google example,

http://code.google.com/apis/maps/documentation/javascript/examples/map-geolocation.html
here is the js

var initialLocation;
var siberia = new google.maps.LatLng(60, 105);
var newyork = new google.maps.LatLng(40.69847032728747, -73.9514422416687);
var browserSupportFlag = new Boolean();
var map;
var infowindow = new google.maps.InfoWindow();

function initialize() {
    var myOptions = {
        zoom: 6,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

    // Try W3C Geolocation method (Preferred)
    if (navigator.geolocation) {
        browserSupportFlag = true;
        alert('here navigator');
        navigator.geolocation.getCurrentPosition(function (position) {
            initialLocation = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
            contentString = "Location found using W3C standard";
            map.setCenter(initialLocation);
            infowindow.setContent(contentString);
            infowindow.setPosition(initialLocation);
            infowindow.open(map);
        }, function () {
            handleNoGeolocation(browserSupportFlag);
        });
    } else if (google.gears) {
        // Try Google Gears Geolocation
        browserSupportFlag = true;
        var geo = google.gears.factory.create('beta.geolocation');
        geo.getCurrentPosition(function (position) {
            initialLocation = new google.maps.LatLng(position.latitude, position.longitude);
            contentString = "Location found using Google Gears";
            map.setCenter(initialLocation);
            infowindow.setContent(contentString);
            infowindow.setPosition(initialLocation);
            infowindow.open(map);
        }, function () {
            handleNoGeolocation(browserSupportFlag);
        });
    } else {
        // Browser doesn't support Geolocation
        browserSupportFlag = false;
        handleNoGeolocation(browserSupportFlag);
    }
}

function handleNoGeolocation(errorFlag) {
    if (errorFlag == true) {
        initialLocation = newyork;
        contentString = "Error: The Geolocation service failed.";
    } else {
        initialLocation = siberia;
        contentString = "Error: Your browser doesn't support geolocation. Are you in Siberia?";
    }
    map.setCenter(initialLocation);
    infowindow.setContent(contentString);
    infowindow.setPosition(initialLocation);
    infowindow.open(map);
}

any ideas..
thanks mike

  • 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-20T22:11:00+00:00Added an answer on May 20, 2026 at 10:11 pm

    Yes did get it working. But i wrote my own navigator object in js, and bridged to the java via a jsinterface. Basically i got GPS working in a non web app first. Then wrote a java script interface in java. And then called the jsinterface in java from js to get geo. The good thing about my approach is it should work on 1.5 and up and it works on the emulator. Bad news is that it takes shyt load of coding. This approach will work but unfortunately in 2.3 the javascript interface is not very stable – other versions of android are ok.

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

Sidebar

Related Questions

We have an single-page web app that displays emails. Some of the emails we're
I have a web app that runs fine in Visual web developer. But when
I have a mobile web app that displays a dialog box within a position:
I have a web app which displays a list of emails that need to
I have a Rails 3.0.x app, which displays a page containing the Yahoo Web
I have a web app that displays the profile of over 600 people, and
I have a web app that reads data from a SQL DB that contains
I have a web app that has a big and complex form (fields, checks,
We have an web app that is talking to Netsuite via Netsuite's web services.
I have a web app that I've recently applied a jQuery ThemeRoller theme to.

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.