Need to use EclairClient for 3.x devices too. This fixes the HTML5 geolocation problem on Android 3.x.

This commit is contained in:
Bryce Curtis 2011-05-10 11:44:09 -05:00
parent 116169a4c5
commit 839c577243

View File

@ -125,8 +125,8 @@ public class DroidGap extends PhonegapActivity {
private String baseUrl; private String baseUrl;
// Plugin to call when activity result is received // Plugin to call when activity result is received
private Plugin activityResultCallback = null; protected Plugin activityResultCallback = null;
private boolean activityResultKeepRunning; protected boolean activityResultKeepRunning;
// Flag indicates that a loadUrl timeout occurred // Flag indicates that a loadUrl timeout occurred
private int loadUrlTimeout = 0; private int loadUrlTimeout = 0;
@ -202,11 +202,11 @@ public class DroidGap extends PhonegapActivity {
WebViewReflect.checkCompatibility(); WebViewReflect.checkCompatibility();
if (android.os.Build.VERSION.RELEASE.startsWith("2.")) { if (android.os.Build.VERSION.RELEASE.startsWith("1.")) {
this.appView.setWebChromeClient(new EclairClient(DroidGap.this)); this.appView.setWebChromeClient(new GapClient(DroidGap.this));
} }
else { else {
this.appView.setWebChromeClient(new GapClient(DroidGap.this)); this.appView.setWebChromeClient(new EclairClient(DroidGap.this));
} }
this.setWebViewClient(this.appView, new GapViewClient(this)); this.setWebViewClient(this.appView, new GapViewClient(this));
@ -850,13 +850,13 @@ public class DroidGap extends PhonegapActivity {
} }
return true; return true;
} }
} }
/** /**
* WebChromeClient that extends GapClient with additional support for Android 2.X * WebChromeClient that extends GapClient with additional support for Android 2.X
*/ */
public final class EclairClient extends GapClient { public class EclairClient extends GapClient {
private String TAG = "PhoneGapLog"; private String TAG = "PhoneGapLog";
private long MAX_QUOTA = 100 * 1024 * 1024; private long MAX_QUOTA = 100 * 1024 * 1024;
@ -910,6 +910,12 @@ public class DroidGap extends PhonegapActivity {
} }
@Override @Override
/**
* Instructs the client to show a prompt to ask the user to set the Geolocation permission state for the specified origin.
*
* @param origin
* @param callback
*/
public void onGeolocationPermissionsShowPrompt(String origin, Callback callback) { public void onGeolocationPermissionsShowPrompt(String origin, Callback callback) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
super.onGeolocationPermissionsShowPrompt(origin, callback); super.onGeolocationPermissionsShowPrompt(origin, callback);