android.webkit.GeolocationPermissions Java Examples

The following examples show how to use android.webkit.GeolocationPermissions. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultChromeClient.java    From AgentWeb with Apache License 2.0 6 votes vote down vote up
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);
	}
}
 
Example #2
Source File: CBrowserMainFrame7.java    From appcan-android with GNU Lesser General Public License v3.0 6 votes vote down vote up
@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);
}
 
Example #3
Source File: BridgeWebChromeClient.java    From OsmGo with MIT License 6 votes vote down vote up
/**
 * 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");
  }
}
 
Example #4
Source File: DappBrowserFragment.java    From alpha-wallet-android with MIT License 5 votes vote down vote up
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);
    }
}
 
Example #5
Source File: MainActivity.java    From FaceSlim with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example #6
Source File: WebChromeClientDelegate.java    From AgentWeb with Apache License 2.0 5 votes vote down vote up
@Override
public void onGeolocationPermissionsShowPrompt(String origin,
                                               GeolocationPermissions.Callback callback) {
    if (this.mDelegate != null) {
        this.mDelegate.onGeolocationPermissionsShowPrompt(origin, callback);
        return;
    }
    super.onGeolocationPermissionsShowPrompt(origin, callback);

}
 
Example #7
Source File: MainActivity.java    From privatelocation with GNU General Public License v3.0 5 votes vote down vote up
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
    callback.invoke(origin, true, false);

    if(isLocationPermissionGranted()){
        findLocation();
    }
}
 
Example #8
Source File: WebPlayerView.java    From unity-ads-android with Apache License 2.0 5 votes vote down vote up
@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);
	}
}
 
Example #9
Source File: ProxyWebChromeClient.java    From robotium-extensions with Apache License 2.0 5 votes vote down vote up
@Override
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
    if (originalWebChromeClient != null) {
        originalWebChromeClient.onGeolocationPermissionsShowPrompt(origin, callback);
    } else {
        super.onGeolocationPermissionsShowPrompt(origin, callback);
    }
}
 
Example #10
Source File: GeolocationActivity.java    From Android_Code_Arbiter with GNU Lesser General Public License v3.0 5 votes vote down vote up
@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);
        }
    });
}
 
Example #11
Source File: Html5Webview.java    From UltimateAndroid with Apache License 2.0 4 votes vote down vote up
@Override
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
    callback.invoke(origin, true, false);
}
 
Example #12
Source File: RexxarWebChromeClient.java    From rexxar-android with MIT License 4 votes vote down vote up
@Override
public void onGeolocationPermissionsShowPrompt(String origin,
                                               GeolocationPermissions.Callback callback) {
    callback.invoke(origin, true, false);
}
 
Example #13
Source File: WebViewMapFragment.java    From AirMapView with Apache License 2.0 4 votes vote down vote up
@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);
}
 
Example #14
Source File: Html5Webview.java    From UltimateAndroid with Apache License 2.0 4 votes vote down vote up
@Override
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
    callback.invoke(origin, true, false);
}
 
Example #15
Source File: PrivateActivity.java    From SimplicityBrowser with MIT License 4 votes vote down vote up
@Override
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
    callback.invoke(origin, true, false);
    super.onGeolocationPermissionsShowPrompt(origin, callback);
}
 
Example #16
Source File: Html5Webview.java    From UltimateAndroid with Apache License 2.0 4 votes vote down vote up
@Override
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
    callback.invoke(origin, true, false);
}
 
Example #17
Source File: BaseWebView.java    From evercam-android with GNU Affero General Public License v3.0 4 votes vote down vote up
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions
        .Callback callback) {
    callback.invoke(origin, true, false);
}
 
Example #18
Source File: NullContentsClient.java    From android-chromium with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public void onGeolocationPermissionsShowPrompt(String origin,
        GeolocationPermissions.Callback callback) {
}
 
Example #19
Source File: AwContentsClient.java    From android-chromium with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public abstract void onGeolocationPermissionsShowPrompt(String origin,
GeolocationPermissions.Callback callback);
 
Example #20
Source File: NullContentsClient.java    From android-chromium with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public void onGeolocationPermissionsShowPrompt(String origin,
        GeolocationPermissions.Callback callback) {
}
 
Example #21
Source File: AwContentsClient.java    From android-chromium with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public abstract void onGeolocationPermissionsShowPrompt(String origin,
GeolocationPermissions.Callback callback);
 
Example #22
Source File: MainActivity.java    From SimplicityBrowser with MIT License 4 votes vote down vote up
@Override
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
    callback.invoke(origin, true, false);
    super.onGeolocationPermissionsShowPrompt(origin, callback);
}
 
Example #23
Source File: HTML5WebView.java    From BigApp_Discuz_Android with Apache License 2.0 4 votes vote down vote up
@Override
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
    callback.invoke(origin, true, false);
}
 
Example #24
Source File: Html5Activity.java    From ClassSchedule with Apache License 2.0 4 votes vote down vote up
@Override
public void onGeolocationPermissionsShowPrompt(final String origin, final GeolocationPermissions.Callback callback) {
    callback.invoke(origin, true, false);//注意个函数,第二个参数就是是否同意定位权限,第三个是是否希望内核记住
    super.onGeolocationPermissionsShowPrompt(origin, callback);
}
 
Example #25
Source File: GoogleMapActivity.java    From Android with MIT License 4 votes vote down vote up
@Override
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
    callback.invoke(origin, true, false);
    super.onGeolocationPermissionsShowPrompt(origin, callback);
}
 
Example #26
Source File: RobotiumWebClient.java    From AndroidRipper with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
	if (originalWebChromeClient != null) {
		originalWebChromeClient.onGeolocationPermissionsShowPrompt(origin, callback);
	} 
}
 
Example #27
Source File: DefaultChromeClient.java    From AgentWeb with Apache License 2.0 4 votes vote down vote up
@Override
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
	onGeolocationPermissionsShowPromptInternal(origin, callback);
}
 
Example #28
Source File: ReactWebViewManager.java    From react-native-GPay with MIT License 4 votes vote down vote up
@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;
}
 
Example #29
Source File: VideoEnabledWebChromeClient.java    From carstream-android-auto with Apache License 2.0 4 votes vote down vote up
@Override
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
    super.onGeolocationPermissionsShowPrompt(origin, callback);
    callback.invoke(origin, true, true);
}
 
Example #30
Source File: WebChromeClientListener.java    From JsBridge with MIT License 2 votes vote down vote up
@Override
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {

}