I'd like to register an intent filter so that the "View work address" action in the People app can launch my app - but what is that intent ?
-
1@down voter: whats the problem ? Voting down without reason accomplishes NOTHING – Someone Somewhere Jul 20 '11 at 05:33
1 Answers
After searching all day through the Contacts source code, I came up with the following solution:
- go to the Google market and install "Intent Intercept"
- capture the data. In this case it looks like this:
Action: android.intent.action.VIEW
Data: content://com.android.contacts/data/1425
Uri: content://com.android.contacts/data/1425
Type: null
3 activities match this intent:
com.telenav.app.android.sprint
com.google.android.apps.maps
uk.co.ashtonbrsc.android.intentintercept
I then went to the documentation to find out what I should have gotten...
http://developer.android.com/guide/appendix/g-app-intents.html
As you can imagine, I was shocked not to see a "geo" scheme used. (which explains why I couldn't find the geo URI in the source code).
EDIT: I am trying to implement the app's intent-filter; it's not so easy to hack this...
this works - but it also captures intents other than "View work address" (which is not good)
<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>
EDIT 2: this is the best intent-filter I can come up with for this scenario
<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>
EDIT 3: I can do better ... this is the EXACT intent filter to use
<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>

- 23,475
- 11
- 118
- 166