2017-06-20 129 views
2

我試圖打開應用程序使用AppLinking或特定URL DeepLinking應用上進行鏈接或深層鏈接

按照我所瞭解:

<data android:scheme="http" 
    android:host="example.org" 
    android:pathPrefix="/app"/> 

我必須按照這個格式接收與網址:http://example.org/app/ ......

,但我擔心的是,我有兩個網址 https://example.org/somestring(URL打開產品說明書) ProductDescActivity https://example.org/somestring-VS-somestring(URL打開產品比較) ProductCompActivity

我已經定義在mainfest文件結構等上面,但我不具有固定的PathPrefix

<data android:scheme="http" 
    android:host="example.org" 
    android:pathPrefix="?????????"/> 

如果我這種結構添加到這兩個我的活動可能會同時打開這兩個活動

如何管理請求併爲這種url請求執行AppIndexing,其中pathPrefix i不是固定的或者更直 如何處理URL沒有任何的子域

+0

你永遠不能打開兩個活動一次。如果發生重疊,會發生什麼情況?您會得到一個選擇器,要求您選擇要使用的應用程序 - 並且您的應用程序將被列出兩次。它實際上相當混亂。 –

+0

@GabeSechan哦,我得到你了,好吧,確定他們將會是列表中的兩個應用程序啓動器圖標,一個用於活動A,另一個用於B,這不太好!不管怎麼說! thanx爲您的關注!欣賞它 – Peter

回答

1

儘量保持應用程序鏈接到主活動 意味着這個

<data android:scheme="http" 
    android:host="example.org" 
    /> 

將在MainActivity中指定,並在mainActivity按照您所知的方式檢測URL類型,然後從mainactivity將其指向特定活動產品描述或產品比較

第二種選擇是您指定具有pathprefix的URL,例如XYZ,並在服務器端將URL重定向到a ctual URL

<data android:scheme="http" 
    android:host="example.org" 
    android:pathPrefix="XYZ"/> 

https://example.org/XYZ/somestring ----->重定向到https://example.org/somestring

+0

第二次停頓,我將在從mainactivity轉移到PD或PC的過程中,將面臨什麼。你有沒有試過這個東西!是不值得注意的滯後! 喜歡你的第二個選項也很難 – Peter