2011-07-20 37 views

回答

3

通過聯繫人源代碼中搜索了一整天后,我想出了以下解決方案:

  1. 轉到谷歌的市場和安裝「意圖攔截」
  2. 捕獲的數據。在這種情況下,它看起來是這樣的:

操作: android.intent.action.VIEW

數據:內容://com.android.contacts/data/1425

烏里:內容://com.android.contacts/data/1425

類型

com.telenav.app.android.sprint

com.google.android.apps.maps

uk.co.ashtonbrsc:空

3活動這個意圖匹配.android.intentintercept

然後,我去了文檔,找出我應該得到什麼...

http://developer.android.com/guide/appendix/g-app-intents.html

你可以想象,我很震驚沒有看到使用「地理」方案。 (這解釋了爲什麼我在源代碼中找不到地理URI)。


編輯:我想實現應用程序的意圖過濾器;它不是那麼容易破解這個...

這個作品 - 但它也捕捉比「查看工作地址」等意圖(這是不好的)

 <intent-filter> 
      <action android:name="android.intent.action.VIEW" /> 
      <category android:name="android.intent.category.DEFAULT" /> 

      <data android:mimeType="*/*" android:scheme="content" android:host="com.android.contacts" /> 

     </intent-filter> 

編輯2:這是最好的意圖過濾器,我可以想出這種情況下

 <intent-filter> 
      <action android:name="android.intent.action.VIEW" /> 
      <category android:name="android.intent.category.DEFAULT" /> 
      <data android:mimeType="vnd.android.cursor.item/*" android:host="com.android.contacts" /> 
     </intent-filter> 

編輯3:我可以做的更好......這是確切的意圖過濾器使用

 <intent-filter> 
      <action android:name="android.intent.action.VIEW" /> 
      <category android:name="android.intent.category.DEFAULT" /> 
      <data android:mimeType="vnd.android.cursor.item/*" android:host="com.android.contacts" android:pathPrefix="/data" android:scheme="content"/> 
     </intent-filter>