【问题标题】:google plus open inside webview instead out of the wrappergoogle plus 在 webview 中打开而不是在包装器中打开
【发布时间】:2017-04-12 08:05:31
【问题描述】:

我有一个带有 webview 的 android 应用程序。点击 FB 或 Instagram 等外部链接时 - 打开新的 chrome 窗口。点击 Google+ 时 - 应用程序在 web 视图中打开。我想从包装器中打开 G+(已实现),但也想设法重定向到某个配置文件。 这是我的代码:

 Intent intent = new Intent(Intent.ACTION_VIEW);
 intent.setData(Uri.parse("https://plus.google.com/profile/posts")); 
 startActivity(intent);

上面的代码在我不希望它的包装器中打开 G+..

 PackageManager pm = getPackageManager();
 Intent launchIntent = pm.getLaunchIntentForPackage("com.google.android.apps.plus");
 if (launchIntent != null) {
 //intent.setClassName("com.google.android.apps.plus",
          //  "com.google.android.apps.plus.phone.UrlGatewayActivity");
 launchIntent.putExtra("customAppUri",profile);
 startActivity(launchIntent);}

上面的代码实际上是从包装器中打开 G+ 应用程序,但它没有重定向到个人资料页面。

有什么建议吗?

【问题讨论】:

    标签: android webview google-plus


    【解决方案1】:

    显然 G+ 将他们的活动名称更改为“com.google.android.libraries.social.gateway.GatewayActivity”。相应更新,效果完美!

    更新后的代码:

        PackageManager pm = getPackageManager();
        Intent launchIntent = 
        pm.getLaunchIntentForPackage("com.google.android.apps.plus");
        if (launchIntent != null) {
        intent.setClassName("com.google.android.apps.plus",
            "com.google.android.libraries.social.gateway.GatewayActivity");
        launchIntent.putExtra("customAppUri",profile);
        startActivity(launchIntent);}
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-10-10
      • 1970-01-01
      • 1970-01-01
      • 2014-05-22
      • 2012-12-02
      • 1970-01-01
      • 2018-02-16
      相关资源
      最近更新 更多