2013-12-20 62 views
8

我試圖使用從Google+到Google+應用的深度鏈接,然後輸入http://developers.google.com/+/mobile/android/share/deep-link將鏈接深度鏈接到Google+,但鏈接沒有任何作用

我可以分享到Google+。帖子中的鏈接是「可點擊的」(觸摸時突出顯示),但在發佈時不做任何事情。此外,該帖子還包含可疑的「未定義」文本行。

sample http://raw.github.com/concreterose/TestDeepLink/master/README_ASSETS/sample_share.png

我已經在谷歌開發者控制檯項目憑證啓用深層鏈接。

我使用一個簽名,與Scopes.PLUS_LOGIN創建PlusClient,通過發佈:

Intent shareIntent = new PlusShare.Builder(this, plusClient) 
    .setText("Testing deep link") 
    .setType("text/plain") 
    .setContentDeepLinkId("deeplink", 
     "title", 
     "description", 
     Uri.parse(thumbnailUrl)) 
    .getIntent(); 
startActivityForResult(shareIntent, 0); 

我不知道如果我需要所有這些,而試圖把事情的工作,我有:

<uses-permission android:name="android.permission.INTERNET" /> 
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 
<uses-permission android:name="android.permission.USE_CREDENTIALS" /> 
<uses-permission android:name="android.permission.GET_ACCOUNTS" /> 

的處理活動(給定爲清單中的第一個活動):

<activity android:name=".ParseDeepLinkActivity"> 
     <intent-filter> 
      <action android:name="com.google.android.apps.plus.VIEW_DEEP_LINK" /> 
      <data android:scheme="vnd.google.deeplink" /> 
      <category android:name="android.intent.category.DEFAULT" /> 
      <category android:name="android.intent.category.BROWSABLE" /> 
     </intent-filter> 
    </activity> 

是:

public class ParseDeepLinkActivity extends Activity { 
    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     Log.i(TAG, "onCreate"); 
     throw new RuntimeException("got here"); 
    } 
} 

我正在構建發行密鑰庫並在運行4.4的多個實際設備上進行測試。

我已經試過:

  • 使用PlusShare.Builder(activity)構造函數(不plusClient),沒有變化。使用addCallToAction(label, uri, deeplink)代替setContentDeepLinkId。沒有號召性用語按鈕,點擊帖子後轉到uri而不是深度鏈接。

  • 在開發人員控制檯中正確設置三重檢查「深層鏈接:已啓用」。

  • 建設沒有proguard,沒有變化。

  • 卸載應用程序然後點擊鏈接(應該打開Play商店條目),什麼也不做。

  • 使用不同的密鑰簽名。加號登錄失敗(按預期)。

  • 使用不同版本的播放服務(4.0.30 vs 3.2。+)。

  • adb shell setprop log.tag.GooglePlusPlatform VERBOSE不生成任何日誌消息。

  • 獲取我的API訪問令牌並驗證它有auth/plus.login,它的確如此。

誰能告訴我我做錯了什麼?謝謝!!

更新:這現在正在工作,顯然是由Google Play服務更新修復的。

+0

仍在更新到谷歌播放服務(對設備和應用的build.gradle)4.1.32後失敗。 – Darrell

回答

0

它通常最好共享一個標記爲schema.org的URL,而不是傳遞標題,描述和圖像。由於沒有URL,鏈接將永遠不會在網頁上點擊(您需要使用setContentURL才能擁有該鏈接) - 但它應該在Android上打開應用程序。

這就是說,未定義確實看起來可疑。這裏有兩件事情,第一件是鏈接不起作用,第二件說明不再以普通股形式顯示。 Android的交互式帖子存在一個已知問題,希望在新的一年的早些時候解決,我想知道這是否也影響了深度鏈接的共享。爲了縮小範圍,您可以嘗試使用schema.org標記setContentURL中的URL(例如https://developers.google.com/+/web/snippet/examples/thing),並在setContentDeeplink調用上傳遞null作爲標題,圖像和描述嗎?

+0

只是爲了確保這是我的錯誤,而不是基礎設施問題,你能指點我的應用程序共享和接收深層鏈接嗎?我一直無法制作我的最小測試應用程序和Google照片搜索示例。謝謝! – Darrell