mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-19 15:12:51 +08:00
Turning off the Native WebKit Geolcation
This commit is contained in:
parent
827c0ec81f
commit
72fd058b9e
@ -111,6 +111,9 @@ public class DroidGap extends Activity {
|
|||||||
// Turn on DOM storage!
|
// Turn on DOM storage!
|
||||||
WebViewReflect.setDomStorage(settings);
|
WebViewReflect.setDomStorage(settings);
|
||||||
|
|
||||||
|
// Turn OFF Native Geolocation
|
||||||
|
WebViewReflect.setGeolocation(settings);
|
||||||
|
|
||||||
/* Bind the appView object to the gap class methods */
|
/* Bind the appView object to the gap class methods */
|
||||||
bindBrowser(appView);
|
bindBrowser(appView);
|
||||||
if(cupcakeStorage != null)
|
if(cupcakeStorage != null)
|
||||||
|
@ -10,6 +10,7 @@ public class WebViewReflect {
|
|||||||
private static Method mWebSettings_setDatabaseEnabled;
|
private static Method mWebSettings_setDatabaseEnabled;
|
||||||
private static Method mWebSettings_setDatabasePath;
|
private static Method mWebSettings_setDatabasePath;
|
||||||
private static Method mWebSettings_setDomStorageEnabled;
|
private static Method mWebSettings_setDomStorageEnabled;
|
||||||
|
private static Method mWebSettings_setGeolocationEnabled;
|
||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
@ -48,6 +49,8 @@ public class WebViewReflect {
|
|||||||
"setDatabasePath", new Class[] { String.class });
|
"setDatabasePath", new Class[] { String.class });
|
||||||
mWebSettings_setDomStorageEnabled = WebSettings.class.getMethod(
|
mWebSettings_setDomStorageEnabled = WebSettings.class.getMethod(
|
||||||
"setDomStorageEnabled", new Class[] { boolean.class });
|
"setDomStorageEnabled", new Class[] { boolean.class });
|
||||||
|
mWebSettings_setGeolocationEnabled = WebSettings.class.getMethod(
|
||||||
|
"setGeolocationEnabled", new Class[] { boolean.class });
|
||||||
/* success, this is a newer device */
|
/* success, this is a newer device */
|
||||||
} catch (NoSuchMethodException nsme) {
|
} catch (NoSuchMethodException nsme) {
|
||||||
/* failure, must be older device */
|
/* failure, must be older device */
|
||||||
@ -72,7 +75,6 @@ public class WebViewReflect {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* feature not supported, do something else */
|
/* feature not supported, do something else */
|
||||||
System.out.println("Database not supported");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,7 +97,30 @@ public class WebViewReflect {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* feature not supported, do something else */
|
/* feature not supported, do something else */
|
||||||
System.out.println("DOM Storage not supported");
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setGeolocation(WebSettings setting)
|
||||||
|
{
|
||||||
|
if(mWebSettings_setGeolocationEnabled != null)
|
||||||
|
{
|
||||||
|
/* feature is supported */
|
||||||
|
try {
|
||||||
|
mWebSettings_setGeolocationEnabled.invoke(setting, false);
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (InvocationTargetException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* feature not supported, do something else */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user