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. drawing views on top

Hi All,

I am trying to draw a custom view extending linearlayout and put a
scrollview within that.

I should be able to draw objects on top of scrollview.

But the views which i draw are drawing down the scrollview.It is not drawing
on top layer of scrollview.

I tried with framelayout.But it is not drawing down of scrollview only.

How to make it to draw on top?

I tried using FrameLayout.But still same problem.

Please help.It is very urgent.

I have attached code for your reference.

main.xml
-----------------
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"

    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/mylayout"
    >

<FrameLayout      xmlns:android="http://schemas.android.com/apk/res/android"

                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    >


 <com.horizonscroll.TransparentPanel
                android:id="@+id/transparent_panel"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                    android:background="#FFFFFF"

            >

        <com.horizonscroll.ScrollImageView
    android:id = "@+id/scrollView"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"

    />


</com.horizonscroll.TransparentPanel>

</FrameLayout>

  </FrameLayout>


TransparentPanel.java
------------------------------
public class TransparentPanel extends LinearLayout {



     private static Vector<Square> squares;
        private static Vector<Tile> tiles;
        private static Tile movingTile=null;

    private Paint    touchPaint;

    public TransparentPanel(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(context);
    }

    public TransparentPanel(Context context) {
        super(context);
        init(context);
    }

    private void init(Context context)
    {

         squares=Util.generateBoardSquares();
         tiles=Util.generateTiles(context);


    }

    @Override
    public boolean onTouchEvent(MotionEvent event)
    {

        System.out.println(event.getY());
        int x=(int) event.getX();
        int y=(int) event.getY();


        if(event.getAction() == MotionEvent.ACTION_DOWN){
            for(int i=0;i<tiles.size();i++){
                if(tiles.get(i).isTouched(x, y)){
                    movingTile=tiles.get(i);
                    break;

                }
            }
        }

        if(event.getAction() == MotionEvent.ACTION_MOVE){
        if(movingTile != null){
            movingTile.setX(x);
            movingTile.setY(y);
            invalidate();
        }
        }

        if(event.getAction() == MotionEvent.ACTION_UP){
            if(movingTile != null){
                movingTile=null;
            }
        }



        invalidate();


        return true;
    }

    @Override
    protected void onDraw(Canvas canvas)
    {

      for(int i=0;i<tiles.size();i++){
            Tile tile=tiles.get(i);
            tile.onDraw(canvas,  touchPaint,tile.getX(),tile.getY());

        }

        super.dispatchDraw(canvas);

    }
}

Activity
----------------------

public class HorizoontalScroll extends Activity
{
      public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);

        requestWindowFeature(Window.FEATURE_NO_TITLE);

        setContentView(R.layout.main);
}
}

-- 

2. Multiple audio channels

Hi all !

 I have to write an application wihich can play multiple audio
chennels. My boss asked me to make some market research how many
device able to play multiple audio channels on the same time.
 Where can I check the android phones hardware capacity, which one can
do this and which don't. What do you think where should I start the
research ? Please , if anybody know about it help to me.

 Thank you: Karoly

-- 

3. problem with AVD manager (last version) on XML verification failed.

4. cara tau HH sudah unlock apa belu

5. Root milestone

6. Use HTTP persistent connection

7. How to get notified when list view is displayed