當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。