android.webkit.GeolocationPermissions源码实例Demo

类android.webkit.GeolocationPermissions源码实例Demo

下面列出了android.webkit.GeolocationPermissions 类实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: AgentWeb   文件: DefaultChromeClient.java
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.mOrigin = origin;
		ActionActivity.start(mActivity, mAction);
	}
}
 
源代码2 项目: OsmGo   文件: BridgeWebChromeClient.java
/**
 * Handle the browser geolocation prompt
 * @param origin
 * @param callback
 */
@Override
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
  super.onGeolocationPermissionsShowPrompt(origin, callback);
  Log.d(LogUtils.getCoreTag(), "onGeolocationPermissionsShowPrompt: DOING IT HERE FOR ORIGIN: " + origin);

  // Set that we want geolocation perms for this origin
  callback.invoke(origin, true, false);

  Plugin geo = bridge.getPlugin("Geolocation").getInstance();
  if (!geo.hasRequiredPermissions()) {
    geo.pluginRequestAllPermissions();
  } else {
    Log.d(LogUtils.getCoreTag(), "onGeolocationPermissionsShowPrompt: has required permis");
  }
}
 
源代码3 项目: appcan-android   文件: CBrowserMainFrame7.java
@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);
}
 
源代码4 项目: privatelocation   文件: MainActivity.java
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
    callback.invoke(origin, true, false);

    if(isLocationPermissionGranted()){
        findLocation();
    }
}
 
private void requestGeoPermission(String origin, GeolocationPermissions.Callback callback)
{
    if (ContextCompat.checkSelfPermission(getActivity().getApplicationContext(), Manifest.permission.ACCESS_FINE_LOCATION)
            != PackageManager.PERMISSION_GRANTED)
    {
        geoCallback = callback;
        geoOrigin = origin;
        String[] permissions = new String[]{Manifest.permission.ACCESS_FINE_LOCATION};
        getActivity().requestPermissions(permissions, REQUEST_FINE_LOCATION);
    }
    else
    {
        callback.invoke(origin, true, false);
    }
}
 
源代码6 项目: AgentWeb   文件: WebChromeClientDelegate.java
@Override
public void onGeolocationPermissionsShowPrompt(String origin,
                                               GeolocationPermissions.Callback callback) {
    if (this.mDelegate != null) {
        this.mDelegate.onGeolocationPermissionsShowPrompt(origin, callback);
        return;
    }
    super.onGeolocationPermissionsShowPrompt(origin, callback);

}
 
@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);
        }
    });
}
 
@Override
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
    if (originalWebChromeClient != null) {
        originalWebChromeClient.onGeolocationPermissionsShowPrompt(origin, callback);
    } else {
        super.onGeolocationPermissionsShowPrompt(origin, callback);
    }
}
 
源代码9 项目: unity-ads-android   文件: WebPlayerView.java
@Override
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
	if (shouldCallSuper("onGeolocationPermissionsShowPrompt")) {
		super.onGeolocationPermissionsShowPrompt(origin, callback);
	}
	if (shouldSendEvent("onGeolocationPermissionsShowPrompt")) {
		WebViewApp.getCurrentApp().sendEvent(WebViewEventCategory.WEBPLAYER, WebPlayerEvent.GEOLOCATION_PERMISSIONS_SHOW, origin, viewId);
	}
}
 
源代码10 项目: FaceSlim   文件: MainActivity.java
public void onGeolocationPermissionsShowPrompt(String origin,
                                               GeolocationPermissions.Callback callback) {
    /** Request location permission.
     *  If granted it's awesome and go on,
     *  otherwise just stop here and leave the method.
     */
    requestLocationPermission();
    if (!hasLocationPermission())
        return;

    callback.invoke(origin, true, false);
}
 
@Override
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
    super.onGeolocationPermissionsShowPrompt(origin, callback);
    callback.invoke(origin, true, true);
}
 
源代码12 项目: react-native-GPay   文件: ReactWebViewManager.java
@Override
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
protected WebView createViewInstance(ThemedReactContext reactContext) {
  ReactWebView webView = createReactWebViewInstance(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);
  WebSettings settings = webView.getSettings();
  settings.setBuiltInZoomControls(true);
  settings.setDisplayZoomControls(false);
  settings.setDomStorageEnabled(true);

  settings.setAllowFileAccess(false);
  settings.setAllowContentAccess(false);
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
    settings.setAllowFileAccessFromFileURLs(false);
    setAllowUniversalAccessFromFileURLs(webView, false);
  }
  setMixedContentMode(webView, "never");

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

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

  return webView;
}
 
源代码13 项目: AgentWeb   文件: DefaultChromeClient.java
@Override
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
	onGeolocationPermissionsShowPromptInternal(origin, callback);
}
 
源代码14 项目: AndroidRipper   文件: RobotiumWebClient.java
@Override
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
	if (originalWebChromeClient != null) {
		originalWebChromeClient.onGeolocationPermissionsShowPrompt(origin, callback);
	} 
}
 
源代码15 项目: Android   文件: GoogleMapActivity.java
@Override
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
    callback.invoke(origin, true, false);
    super.onGeolocationPermissionsShowPrompt(origin, callback);
}
 
源代码16 项目: ClassSchedule   文件: Html5Activity.java
@Override
public void onGeolocationPermissionsShowPrompt(final String origin, final GeolocationPermissions.Callback callback) {
    callback.invoke(origin, true, false);//注意个函数,第二个参数就是是否同意定位权限,第三个是是否希望内核记住
    super.onGeolocationPermissionsShowPrompt(origin, callback);
}
 
源代码17 项目: BigApp_Discuz_Android   文件: HTML5WebView.java
@Override
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
    callback.invoke(origin, true, false);
}
 
源代码18 项目: SimplicityBrowser   文件: PrivateActivity.java
@Override
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
    callback.invoke(origin, true, false);
    super.onGeolocationPermissionsShowPrompt(origin, callback);
}
 
源代码19 项目: SimplicityBrowser   文件: MainActivity.java
@Override
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
    callback.invoke(origin, true, false);
    super.onGeolocationPermissionsShowPrompt(origin, callback);
}
 
源代码20 项目: rexxar-android   文件: RexxarWebChromeClient.java
@Override
public void onGeolocationPermissionsShowPrompt(String origin,
                                               GeolocationPermissions.Callback callback) {
    callback.invoke(origin, true, false);
}
 
源代码21 项目: AirMapView   文件: WebViewMapFragment.java
@Override public void onGeolocationPermissionsShowPrompt(
    String origin, GeolocationPermissions.Callback callback) {
  // Always grant permission since the app itself requires location
  // permission and the user has therefore already granted it
  callback.invoke(origin, true, false);
}
 
源代码22 项目: UltimateAndroid   文件: Html5Webview.java
@Override
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
    callback.invoke(origin, true, false);
}
 
源代码23 项目: UltimateAndroid   文件: Html5Webview.java
@Override
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
    callback.invoke(origin, true, false);
}
 
源代码24 项目: UltimateAndroid   文件: Html5Webview.java
@Override
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
    callback.invoke(origin, true, false);
}
 
源代码25 项目: evercam-android   文件: BaseWebView.java
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions
        .Callback callback) {
    callback.invoke(origin, true, false);
}
 
源代码26 项目: android-chromium   文件: NullContentsClient.java
@Override
public void onGeolocationPermissionsShowPrompt(String origin,
        GeolocationPermissions.Callback callback) {
}
 
源代码27 项目: android-chromium   文件: AwContentsClient.java
public abstract void onGeolocationPermissionsShowPrompt(String origin,
GeolocationPermissions.Callback callback);
 
源代码28 项目: android-chromium   文件: NullContentsClient.java
@Override
public void onGeolocationPermissionsShowPrompt(String origin,
        GeolocationPermissions.Callback callback) {
}
 
源代码29 项目: android-chromium   文件: AwContentsClient.java
public abstract void onGeolocationPermissionsShowPrompt(String origin,
GeolocationPermissions.Callback callback);
 
源代码30 项目: quickhybrid-android   文件: QuickWebChromeClient.java
/**
 * 请求定位
 *
 * @param origin
 * @param callback
 */
@Override
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
    callback.invoke(origin, true, false);
    super.onGeolocationPermissionsShowPrompt(origin, callback);
}