当前位置: 首页>>代码示例>>Java>>正文


Java GeolocationPermissions类代码示例

本文整理汇总了Java中android.webkit.GeolocationPermissions的典型用法代码示例。如果您正苦于以下问题:Java GeolocationPermissions类的具体用法?Java GeolocationPermissions怎么用?Java GeolocationPermissions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


GeolocationPermissions类属于android.webkit包,在下文中一共展示了GeolocationPermissions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createViewInstance

import android.webkit.GeolocationPermissions; //导入依赖的package包/类
@Override
protected WebView createViewInstance(ThemedReactContext reactContext) {
  ReactWebView webView = new ReactWebView(reactContext);
  webView.setWebChromeClient(new WebChromeClient() {
    @Override
    public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
      callback.invoke(origin, true, false);
    }
  });
  reactContext.addLifecycleEventListener(webView);
  mWebViewConfig.configWebView(webView);
  webView.getSettings().setBuiltInZoomControls(true);
  webView.getSettings().setDisplayZoomControls(false);

  // Fixes broken full-screen modals/galleries due to body height being 0.
  webView.setLayoutParams(
          new LayoutParams(LayoutParams.MATCH_PARENT,
              LayoutParams.MATCH_PARENT));

  if (ReactBuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    WebView.setWebContentsDebuggingEnabled(true);
  }

  return webView;
}
 
开发者ID:Right-Men,项目名称:Ironman,代码行数:26,代码来源:ReactWebViewManager.java

示例2: onGeolocationPermissionsShowPrompt

import android.webkit.GeolocationPermissions; //导入依赖的package包/类
@Override
public void onGeolocationPermissionsShowPrompt(final String origin, final GeolocationPermissions.Callback callback) {
    AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
    builder.setMessage("是否允许获取您的位置信息?");
    DialogInterface.OnClickListener dialogButtonOnClickListener = new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int clickedButton) {
            if (DialogInterface.BUTTON_POSITIVE == clickedButton) {
                callback.invoke(origin, true, true);
            } else if (DialogInterface.BUTTON_NEGATIVE == clickedButton) {
                callback.invoke(origin, false, false);
            }
        }
    };
    builder.setPositiveButton("允许", dialogButtonOnClickListener);
    builder.setNegativeButton("拒绝", dialogButtonOnClickListener);
    builder.show();
    super.onGeolocationPermissionsShowPrompt(origin, callback);
}
 
开发者ID:AppCanOpenSource,项目名称:appcan-android,代码行数:21,代码来源:CBrowserMainFrame7.java

示例3: onCreate

import android.webkit.GeolocationPermissions; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setToolBarTitle(AppConstants.ToolBarTitle.deliveryLogistics);
    initData();
    logisticsWebView.loadUrl("https://m.kuaidi100.com/");
    logisticsWebView.setWebViewClient(new WebViewClient() {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.loadUrl(url);
            return true;
        }


    });
    logisticsWebView.setWebChromeClient(new WebChromeClient() {

        //配置权限(同样在WebChromeClient中实现)
        @Override
        public void onGeolocationPermissionsShowPrompt(String origin,
                                                       GeolocationPermissions.Callback callback) {
            callback.invoke(origin, true, false);
            super.onGeolocationPermissionsShowPrompt(origin, callback);
        }

    });

}
 
开发者ID:MedicationReminder,项目名称:MedicationReminder,代码行数:29,代码来源:LogisticsWebActivity.java

示例4: onGeolocationPermissionsShowPrompt

import android.webkit.GeolocationPermissions; //导入依赖的package包/类
public void onGeolocationPermissionsShowPrompt(String origin,
                                               GeolocationPermissions.Callback callback) {
    if (this.mRealWebChromeClient != null){
        this.mRealWebChromeClient.onGeolocationPermissionsShowPrompt(origin, callback);
        return;
    }
    super.onGeolocationPermissionsShowPrompt(origin,callback);

}
 
开发者ID:Justson,项目名称:AgentWeb,代码行数:10,代码来源:WebChromeClientWrapper.java

示例5: onGeolocationPermissionsShowPrompt

import android.webkit.GeolocationPermissions; //导入依赖的package包/类
@Override
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {

    LogUtils.i(TAG, "onGeolocationPermissionsShowPrompt:" + origin + "   callback:" + callback);
    if (AgentWebUtils.isOverriedMethod(mWebChromeClient, "onGeolocationPermissionsShowPrompt", "public void " + ChromePath + ".onGeolocationPermissionsShowPrompt", String.class, GeolocationPermissions.Callback.class)) {
        super.onGeolocationPermissionsShowPrompt(origin, callback);
        return;
    }
    onGeolocationPermissionsShowPromptInternal(origin, callback);
}
 
开发者ID:Justson,项目名称:AgentWeb,代码行数:11,代码来源:DefaultChromeClient.java

示例6: onGeolocationPermissionsShowPromptInternal

import android.webkit.GeolocationPermissions; //导入依赖的package包/类
private void onGeolocationPermissionsShowPromptInternal(String origin, GeolocationPermissions.Callback callback) {

        if (mPermissionInterceptor != null) {
            if (mPermissionInterceptor.intercept(this.mWebView.getUrl(), AgentWebPermissions.LOCATION, "location")) {
                callback.invoke(origin, false, false);
                return;
            }
        }

        Activity mActivity = mActivityWeakReference.get();
        if (mActivity == null) {
            callback.invoke(origin, false, false);
            return;
        }

        List<String> deniedPermissions = null;
        if ((deniedPermissions = AgentWebUtils.getDeniedPermissions(mActivity, AgentWebPermissions.LOCATION)).isEmpty()) {
            LogUtils.i(TAG, "onGeolocationPermissionsShowPromptInternal:" + true);
            callback.invoke(origin, true, false);
        } else {

            Action mAction = Action.createPermissionsAction(deniedPermissions.toArray(new String[]{}));
            mAction.setFromIntention(FROM_CODE_INTENTION_LOCATION);
            ActionActivity.setPermissionListener(mPermissionListener);
            this.mCallback = callback;
            this.origin = origin;
            ActionActivity.start(mActivity, mAction);
        }


    }
 
开发者ID:Justson,项目名称:AgentWeb,代码行数:32,代码来源:DefaultChromeClient.java

示例7: onGeolocationPermissionsShowPrompt

import android.webkit.GeolocationPermissions; //导入依赖的package包/类
@Override
public void onGeolocationPermissionsShowPrompt(final String origin,
                                               final GeolocationPermissions.Callback callback) {
    callback.invoke(origin,
            true,
            true);

    super.onGeolocationPermissionsShowPrompt(origin,
            callback);
}
 
开发者ID:wzx54321,项目名称:XinFramework,代码行数:11,代码来源:WebModel.java

示例8: onCreate

import android.webkit.GeolocationPermissions; //导入依赖的package包/类
@Override
protected void onCreate(Bundle b) {
    super.onCreate(b);

    wv.setWebChromeClient(new WebChromeClient() {
        @Override
        public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
            callback.invoke(origin, true, false);
        }
    });
}
 
开发者ID:blackarbiter,项目名称:Android_Code_Arbiter,代码行数:12,代码来源:GeolocationActivity.java

示例9: onGeolocationPermissionsShowPrompt

import android.webkit.GeolocationPermissions; //导入依赖的package包/类
@Override
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions
        .Callback callback) {
    Log.d(TAG, "onGeolocationPermissionsShowPrompt() called with: origin = [" +
            origin + "], callback = [" + callback + "]");
    callback.invoke(origin, true, true);
    super.onGeolocationPermissionsShowPrompt(origin, callback);
}
 
开发者ID:fendoudebb,项目名称:PlayAndroid,代码行数:9,代码来源:WebViewActivity.java

示例10: createViewInstance

import android.webkit.GeolocationPermissions; //导入依赖的package包/类
@Override
protected WebView createViewInstance(ThemedReactContext reactContext) {
  ReactWebView webView = new ReactWebView(reactContext);
  webView.setWebChromeClient(new WebChromeClient() {
    @Override
    public boolean onConsoleMessage(ConsoleMessage message) {
      if (ReactBuildConfig.DEBUG) {
        return super.onConsoleMessage(message);
      }
      // Ignore console logs in non debug builds.
      return true;
    }

    @Override
    public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
      callback.invoke(origin, true, false);
    }
  });
  reactContext.addLifecycleEventListener(webView);
  mWebViewConfig.configWebView(webView);
  webView.getSettings().setBuiltInZoomControls(true);
  webView.getSettings().setDisplayZoomControls(false);
  webView.getSettings().setDomStorageEnabled(true);

  // Fixes broken full-screen modals/galleries due to body height being 0.
  webView.setLayoutParams(
          new LayoutParams(LayoutParams.MATCH_PARENT,
              LayoutParams.MATCH_PARENT));

  if (ReactBuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    WebView.setWebContentsDebuggingEnabled(true);
  }

  return webView;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:36,代码来源:ReactWebViewManager.java

示例11: onGeolocationPermissionsShowPrompt

import android.webkit.GeolocationPermissions; //导入依赖的package包/类
@Override
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
    if (originalWebChromeClient != null) {
        originalWebChromeClient.onGeolocationPermissionsShowPrompt(origin, callback);
    } else {
        super.onGeolocationPermissionsShowPrompt(origin, callback);
    }
}
 
开发者ID:bitbar,项目名称:robotium-extensions,代码行数:9,代码来源:ProxyWebChromeClient.java

示例12: onGeolocationPermissionsShowPrompt

import android.webkit.GeolocationPermissions; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void onGeolocationPermissionsShowPrompt(String origin,
                                               GeolocationPermissions.Callback callback) {
    // If we are not allowed to use geolocation, show an alert, if possible.
    if (!mAllowGeolocation) {
        if (mListener != null) {
            mListener.showGeolocationDisabledAlert();
        }
    }

    // Invoke the callback stating whether or not geolocation is allowed
    callback.invoke(origin, mAllowGeolocation, false);
}
 
开发者ID:gsurrel,项目名称:MessengerBypasser,代码行数:17,代码来源:FacebookWebChromeClient.java

示例13: onCreate

import android.webkit.GeolocationPermissions; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    mContext = this;
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    if (ContextCompat.checkSelfPermission(this,
            Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED){
        ActivityCompat.requestPermissions(this,
                new String[]{Manifest.permission.ACCESS_FINE_LOCATION,
                        Manifest.permission.ACCESS_COARSE_LOCATION},
                10);
    }

    WebView webview = (WebView) findViewById(R.id.webView);
    webview.setWebViewClient(new WebViewClient());
    webview.getSettings().setJavaScriptEnabled(true);
    webview.loadUrl("http://openpokemap.pw/");
    webview.clearCache(true);

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

    startService(new Intent(this, Background.class));
    startService(new Intent(this, Notifications.class));
}
 
开发者ID:pogointel,项目名称:openmap-client-android,代码行数:30,代码来源:MainActivity.java

示例14: onGeolocationPermissionsShowPrompt

import android.webkit.GeolocationPermissions; //导入依赖的package包/类
@Override
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
    super.onGeolocationPermissionsShowPrompt(origin, callback);
    if(client != null) {
        client.onGeolocationPermissionsShowPrompt(origin, callback);
    }
}
 
开发者ID:yyter,项目名称:SafeWebView,代码行数:8,代码来源:SafeWebView.java

示例15: settingWebView

import android.webkit.GeolocationPermissions; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private void settingWebView() {
    webView.setClickable(true);

    webView.getSettings().setJavaScriptEnabled(true);
    webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);

    if (AndroidSdkVersion.hasJellyBean16()) {
        webView.getSettings().setAllowFileAccessFromFileURLs(true);
        webView.getSettings().setAllowUniversalAccessFromFileURLs(true);
    }

    webView.getSettings().setGeolocationDatabasePath(getContext().getFilesDir().getPath());
    webView.setWebChromeClient(new WebChromeClient() {
        public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
            callback.invoke(origin, true, false);
        }
    });
    webView.setWebViewClient(new WebViewClient() {
        @Override
        public void onPageFinished(WebView view, String url) {
            super.onPageFinished(view, url);
            showProgressView(false);
        }
    });

    webView.addJavascriptInterface(new PostMessage(), "OrchextraJSNativeAndroid");
}
 
开发者ID:Orchextra,项目名称:orchextra-android-sdk,代码行数:29,代码来源:OxWebView.java


注:本文中的android.webkit.GeolocationPermissions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。