本文整理汇总了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;
}
示例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);
}
示例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);
}
});
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
});
}
示例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);
}
示例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;
}
示例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);
}
}
示例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);
}
示例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));
}
示例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);
}
}
示例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");
}