登录时,Android在Web视图中打开Goog​​le Play

时间:2018-03-12 12:28:05

标签: android webview

我的应用程序中有一个webview,我需要打开Goog​​le Play。问题是,当我第一次打开这个WebView时,它要求我登录。这对用户来说不是很方便。有没有办法让用户使用系统凭据登录或从默认浏览器获取凭据?

3 个答案:

答案 0 :(得分:0)

在您的网页视图设置中,请尝试以下操作:

webView.setSavePassword(false);
webVIew.setSaveFormData(false);

答案 1 :(得分:0)

作为应用程序一部分的WebView可能只拥有应用程序提供的最大相同权限。清单中可能需要此权限:https://developer.android.com/reference/android/Manifest.permission.html#USE_CREDENTIALS

答案 2 :(得分:0)

您可以在应用中使用Chrome Tabs库。如果用户已使用自定义标签登录您的应用,则用户也会与Chrome浏览器共享同一会话。

示例代码

CustomTabsIntent customTabsIntent = new CustomTabsIntent.Builder()
    .addDefaultShareMenuItem()
    .setToolbarColor(this.getResources()
        .getColor(R.color.colorPrimary))
    .setShowTitle(true)
    .setCloseButtonIcon(backArrow)
    .build();

// This is optional but recommended
CustomTabsHelper.addKeepAliveExtra(this, customTabsIntent.intent);