w3c geolocation working but prompt not showing

by geow » Thu, 19 May 2011 18:44:46 GMT


Sponsored Links
 Hi everybody, I am trying to embed a web app which uses google maps
JavaScript API and W3C geolocation in a Web View. The applicaion works
but it doesn't show any prompt for geolocation permission to the users
and I cant' find the problem. Here the AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=" http://schemas.android.com/apk/res/android" ;
      package="it.progettaremappeonline"
      android:versionCode="1"
      android:versionName="1.0">
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission
android:name="android.permission.ACCESS_COARSE_LOCATION"/>

    <application android:icon="@drawable/icon" android:label="@string/
app_name" android:debuggable="true" >
        <activity android:name=".bottegheActivity"
                  android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar" >

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category
android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>
</manifest>


And here the java code:

package it.progettaremappeonline;

import android.app.Activity;
import android.os.Bundle;
import android.webkit.GeolocationPermissions.Callback;
import android.webkit.WebChromeClient;
import android.webkit.WebView;


public class bottegheActivity extends Activity {

        WebView webView;

        @Override
        public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        webView = (WebView) findViewById(R.id.webview);
        webView.setScrollBarStyle(webView.SCROLLBARS_INSIDE_OVERLAY);
        webView.getSettings().setJavaScriptEnabled(true);
        webView.getSettings().setGeolocationDatabasePath("/data/data/");
        webView.loadUrl(" http://www.progettaremappeonline.it/test/ 
geolocation2.html");
        webView.setWebChromeClient(new WebChromeClient() {
                 public void onGeolocationPermissionsShowPrompt(String origin,
android.webkit.GeolocationPermissions.Callback callback) {
                    callback.invoke(origin, true, false);
                 }
                });

        }
}


Thanks for helping!!
Giac

-- 



Other Threads

1. How can I override URLs of the resources fetched by the WebKit

Hi

Is there a way to override URLs of any of the resources fetched by the
WebKit?

I know about the
"android.webkit.WebViewClient.shouldOverrideUrlLoading(WebView,
String)", but this method is only called if the loading request is
triggered by a user action, like click on a link for example.

Is there anything which will allow me to overwrite on the fly URLs of
any of the resources referred from the page? I would like to replace
URLs of resources like CSS, images, scripts - effectively any
resources which WebKit needs to render the page.

What I want to achieve is to be able to replace on the fly addresses
like:

http://domain-requested-by-the-user.com
http://domain-requested-by-the-user.com/script.js
http://domain-requested-by-the-user.com/style.css

with something like:

http://MY_DOMAIN.com/?q=domain-requested-by-the-user.com
http://MY_DOMAIN.com/?q=domain-requested-by-the-user.com/script.js
http://MY_DOMAIN.com/?q=domain-requested-by-the-user.com/style.css


Thanks!

-- 

2. JUnit failing with warning - ""test class not found in selected project"

Env:

Eclipse 3.5, Android 0.9.6, Windows XP SP2

Using the Android New project wizard I create a project and a test
project.

Add a simple test to test project extending AndroidTestCase - works
fine.

Add another test to test project extending ProviderTestCase2 - fails.
the JUnit view shows a green bar but with a warning node under the
junit.framework.TestSuite1 node.

When I click on the warning node I see - "test class not found in
selected project"

This is all out of the box - no changes made to the underlying
environment. No useful output in either the Console or LogCat view.

Any suggestions ?

-- 

3. Sygic CFI Problem

4. Problem in packagin .apk from flex application

5. how can application notice that a hotplug device is connected to the system?

6. custom seekbar

7. Android browser - how to disable the green click animation