1

i'm working on an android app in eclipse (version 3.6.2) & i just added the following: import android.webkit.GeolocationPermissions;

But i get an error ... the import cannot be resolved ...

however these omports all DO get resolved: import android.webkit.WebView; import android.webkit.WebViewClient; import android.webkit.HttpAuthHandler; import android.webkit.WebChromeClient; import android.webkit.WebSettings;

can someone tell my why this 1 is unresolved & what i can do to get it to resolve?

thanks

& the answer is :

i needed to upgrade the sdk i was using .. from level 3 to level 5 ...

question answered .. thanks

dennis
  • 21
  • 5

2 Answers2

4

I had this same problem, and the code worked when

public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) { callback.invoke(origin, true, false); }

was changed to

public void onGeolocationPermissionsShowPrompt(String origin, android.webkit.GeolocationPermissions.Callback callback) { callback.invoke(origin, true, false); }

The only subtle difference is using android.webkit.GeolocationPermissions in place of GeolocationPermissions

timrs2998
  • 1,612
  • 18
  • 14
1

I'm using Eclipse Helios Service Release 2. Here is mine... it is built for Android 2.1 and it works fine...

import android.webkit.GeolocationPermissions;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

/* ... your other stuff here ... */

WebView webview1 = (WebView)findViewById(R.id.webView);

/*... more other stuff here ...*/

webview1.getSettings().setJavaScriptEnabled(true);

webview1.setWebChromeClient(new WebChromeClient() {
    public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
        callback.invoke(origin, true, false);
    }
});

webview1.getSettings().setGeolocationDatabasePath("/data/data/<my-app>");

And dont forget to add the following to your manifest:

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> 
<uses-permission android:name="android.permission.ACCESS_GPS" />
<uses-permission android:name="android.permission.ACCESS_ASSISTED_GPS" />
<uses-permission android:name="android.permission.ACCESS_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> 

Hope it helps!

jkanini
  • 376
  • 4
  • 8