2015-10-15 54 views
1

我有一個Android應用程序。我想爲我的應用程序實施App Indexing。應用程序的APP URI索引Android應用程序

我按照谷歌開發者聯繫

https://developers.google.com/app-indexing/android/publish

https://developers.google.com/app-indexing/reference/deeplinks

https://developer.android.com/training/app-indexing/deep-linking.html

https://support.google.com/googleplay/android-developer/answer/6041489

我認識了來自鏈接幾件事情

  1. 我需要驗證我的網站

  2. 使用App Indexing API的在我的活動

,我不明白

  1. 事物的網址是什麼,我應該校驗?

  2. 我應該給APP_URI & WEB_URL?

    static final Uri APP_URI = Uri.parse("android-app://com.example.android.recipes/http/recipe-app.com/recipes"); 
        static final Uri WEB_URL = Uri.parse("http://recipe-app.com/recipes/"); 
    
  3. 什麼是承載我的鏈接的模式?

    android-app://{package_name}/{scheme}/{host_path} 
    
  4. 我應該在Manifest文件中給出什麼樣的數據。

認爲我很新的Android開發。任何示例都是最有幫助的。提前致謝。

回答

3

因此,您已經開始使用Google提供的示例更好地瞭解App-Indexing的工作原理。與覆蓋,我建議你也在座遵循最佳pratices:

https://developer.android.com/training/app-indexing/index.html . 

現在回答你兩點:

1 - 當你與谷歌的例子中看到的,它需要你應用程序在網絡上也有相應的內容,這些內容也被Google編入索引。在這種情況下,該網站是:

http://recipe-app.com 

,如果你同時驗證應用程序&網站這將是最好的。有關如何將您的網站與您的應用關聯的信息存在於https://developers.google.com/app-indexing/android/publish

當前應用索引僅支持具有對應網站的應用。但是,如果您沒有網站,您仍然可以通過提交此表格https://developers.google.com/app-indexing/app-only來顯示您對支持應用程序索引的興趣。

2- Google建議使用App-Indexing API和HTTP意圖方案作爲最佳實踐,所以在這種情況下,您只需要APP_URI。此外,通過這種實現,您不需要對網站標記或站點地圖進行任何更改。因此,在每個應用程序頁面中,您應該在您的網站中使用對應內容的URI來指示APP_URI。

3-假設你正在使用的HTTP方案,您的深層鏈接將類似於此:

android-app://my.app.apk/http/mywebsite.com/sub-domain/content1.html 

4-你的應用程序的清單文件中的數據參數是你定義的深層鏈接的意圖是您的應用程序支持,因此使用我提供了3深層鏈接)的例子,它應該是與此類似:

<data android:scheme="http" 
      android:host="mywebsite.com" 
      android:pathPrefix="/sub-domain" /> 

此意圖將支持通過啓動任何Web網址:

http://mywebsite.com/sub-domain/ 

希望這會有所幫助。

0

我認爲這將是如下更好:

android-app://my.app.apk/http/sub-domain.mywebsite.com/content1.html