2017-04-12 18 views
0

我有一個android應用程序與web視圖。當點擊FB或Instagram等外部鏈接時 - 新的Chrome窗口打開。當點擊Google+時 - 應用程序將在webview中打開。我想從包裝中打開G +(實現),但也想管理重定向到某個配置文件。 這是我的代碼:谷歌加打開裏面的webview而不是包裝

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 +應用了包裝的但它不會重定向到配置文件頁面。

有什麼建議嗎?

回答

0

顯然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);} 
相關問題