android.webkit.WebSettings.setGeolocationDatabasePath()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(152)

本文整理了Java中android.webkit.WebSettings.setGeolocationDatabasePath()方法的一些代码示例,展示了WebSettings.setGeolocationDatabasePath()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebSettings.setGeolocationDatabasePath()方法的具体详情如下:
包路径:android.webkit.WebSettings
类名称:WebSettings
方法名:setGeolocationDatabasePath

WebSettings.setGeolocationDatabasePath介绍

暂无

代码示例

代码示例来源:origin: TheFinestArtist/FinestWebView-Android

settings.setGeolocationDatabasePath(webViewGeolocationDatabasePath);

代码示例来源:origin: Justson/AgentWeb

mWebSettings.setGeolocationDatabasePath(dir);
mWebSettings.setDatabasePath(dir);
mWebSettings.setAppCachePath(dir);

代码示例来源:origin: delight-im/Android-AdvancedWebView

@SuppressLint("NewApi")
protected void setGeolocationDatabasePath() {
  final Activity activity;
  if (mFragment != null && mFragment.get() != null && Build.VERSION.SDK_INT >= 11 && mFragment.get().getActivity() != null) {
    activity = mFragment.get().getActivity();
  }
  else if (mActivity != null && mActivity.get() != null) {
    activity = mActivity.get();
  }
  else {
    return;
  }
  getSettings().setGeolocationDatabasePath(activity.getFilesDir().getPath());
}

代码示例来源:origin: stackoverflow.com

WebSettings settings = webView.getSettings();
settings.setGeolocationDatabasePath(this.getFilesDir().getPath());

代码示例来源:origin: rignaneseleo/SlimSocial-for-Facebook

@SuppressLint("NewApi")
protected void setGeolocationDatabasePath() {
  final Activity activity;
  if (mFragment != null && mFragment.get() != null && Build.VERSION.SDK_INT >= 11 && mFragment.get().getActivity() != null) {
    activity = mFragment.get().getActivity();
  } else if (mActivity != null && mActivity.get() != null) {
    activity = mActivity.get();
  } else {
    return;
  }
  getSettings().setGeolocationDatabasePath(activity.getFilesDir().getPath());
}

代码示例来源:origin: stackoverflow.com

public void importPhoneGapUser() {
  String databasePath = getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();
  String pathToCache = getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();

  WebView mAuthWebView = new WebView(this);
  WebSettings webSettings = mAuthWebView.getSettings();

  webSettings.setDatabasePath(databasePath);
  webSettings.setAppCachePath(pathToCache);
  webSettings.setGeolocationDatabasePath(databasePath);

  webSettings.setAppCacheMaxSize(5 * 1048576);

  webSettings.setAppCacheEnabled(true);
  webSettings.setDatabaseEnabled(true);
  webSettings.setJavaScriptEnabled(true);
  webSettings.setDomStorageEnabled(true);

  mAuthWebView.addJavascriptInterface(new MyJavaScriptInterface (), "JsInterface");

  //i wasn't able to run JS through 'javascript:' protocol, so i had to use a HTML file
  mAuthWebView.loadUrl("file:///android_asset/import_auth.html");
}

代码示例来源:origin: indywidualny/FaceSlim

if (Build.VERSION.SDK_INT < 24) {
  webView.getSettings().setGeolocationDatabasePath(getFilesDir().getPath());

代码示例来源:origin: AndroidHensen/YaNi

/**
 * 初始化网络设置
 */
private void initWebViewSettings() {
  WebSettings webSettings = wv.getSettings();
  //可以有缓存
  webSettings.setAppCacheEnabled(true);
  webSettings.setCacheMode(WebSettings.LOAD_DEFAULT);
  //设置支持页面js可用
  webSettings.setJavaScriptEnabled(true);
  webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
  //设置允许访问文件数据
  webSettings.setAllowFileAccess(true);
  //可以使用localStorage
  webSettings.setDomStorageEnabled(true);
  //可以有数据库
  webSettings.setDatabaseEnabled(true);
  //设置定位的数据库路径
  String dir = getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();
  webSettings.setGeolocationDatabasePath(dir);
  //启用地理定位
  webSettings.setGeolocationEnabled(true);
}

代码示例来源:origin: lv910929/RxDemo

webSettings.setGeolocationDatabasePath(dir);
webSettings.setDomStorageEnabled(true);
activityWebViewBinding.webView.setWebViewClient(myWebViewClient);

代码示例来源:origin: indywidualny/FaceSlim

if (Build.VERSION.SDK_INT < 24) {
  webView.getSettings().setGeolocationDatabasePath(getFilesDir().getPath());

代码示例来源:origin: stackoverflow.com

WebSettings s = getSettings();
s.setBuiltInZoomControls(true);
s.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
s.setUseWideViewPort(true);
s.setLoadWithOverviewMode(true);
s.setSavePassword(true);
s.setSaveFormData(true);
s.setJavaScriptEnabled(true);
s.setRenderPriority(RenderPriority.HIGH);
s.setPluginState(android.webkit.WebSettings.PluginState.ON_DEMAND);

// enable navigator.geolocation 
s.setGeolocationEnabled(true);
s.setGeolocationDatabasePath("");

// enable Web Storage: localStorage, sessionStorage
s.setDomStorageEnabled(true);

代码示例来源:origin: 24Kshign/SuspensionWindow

@SuppressLint("SetJavaScriptEnabled")
private void initWebViewSetting() {
  mWebView.setVerticalScrollBarEnabled(false);
  mWebView.setHorizontalScrollBarEnabled(false);
  WebSettings webSetting = mWebView.getSettings();
  webSetting.setJavaScriptEnabled(true);
  webSetting.setAllowFileAccess(true);
  webSetting.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
  webSetting.setSupportZoom(false);
  webSetting.setBuiltInZoomControls(false);
  webSetting.setUseWideViewPort(true);
  webSetting.setSupportMultipleWindows(false);
  webSetting.setLoadWithOverviewMode(true);
  webSetting.setAppCacheEnabled(true);
  webSetting.setDatabaseEnabled(true);
  webSetting.setGeolocationEnabled(true);
  webSetting.setDomStorageEnabled(true);
  webSetting.setAppCacheMaxSize(Long.MAX_VALUE);
  webSetting.setAppCachePath(getDir("appCache", Context.MODE_PRIVATE).getPath());
  webSetting.setDatabasePath(getDir("databases", Context.MODE_PRIVATE).getPath());
  webSetting.setGeolocationDatabasePath(getDir("geolocation", Context.MODE_PRIVATE).getPath());
  webSetting.setPluginState(WebSettings.PluginState.ON);
  webSetting.setRenderPriority(WebSettings.RenderPriority.HIGH);
  webSetting.setTextSize(WebSettings.TextSize.NORMAL);
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    webSetting.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
  }
  mWebView.loadUrl(mUrl);
}

代码示例来源:origin: 736008081/frameAndroid

String dir = this.getApplicationContext().getDir("database", MODE_PRIVATE).getPath();
webSettings.setGeolocationEnabled(true);
webSettings.setGeolocationDatabasePath(dir);
webSettings.setAllowFileAccess(true);//设置启用或禁止访问文件数据
webSettings.setJavaScriptCanOpenWindowsAutomatically(true);

代码示例来源:origin: stackoverflow.com

s.setGeolocationDatabasePath("/data/data/org.itri.html5webview/databases/");

代码示例来源:origin: stackoverflow.com

webViewSettings.setGeolocationDatabasePath("/data/data/your.app.name/geo");

代码示例来源:origin: stackoverflow.com

s.setGeolocationDatabasePath("/data/data/com.example.vimeotest/databases/");

代码示例来源:origin: stackoverflow.com

settings.setGeolocationDatabasePath(databasePath);

代码示例来源:origin: luoruiyi/Andorid-LiteHybrid-WebView

settings.setGeolocationDatabasePath(databasePath);

代码示例来源:origin: org.seleniumhq.selenium/selenium-android-driver

settings.setGeolocationDatabasePath("/data/data/webdriver");

相关文章

微信公众号

最新文章

更多

WebSettings类方法