各位,在查看联系人时,您可以按地址以在 map 应用程序(例如 Google map 或 VZW Navigator)中查看该地址。我想定义一个 Intent 过滤器,以便我的应用程序将显示在可以处理所述 Intent 的应用程序列表中。有什么想法吗?
提前致谢。
从 logcat 中,我从 ActivityManager 看到以下内容:
Starting activity:
Intent { act=android.intent.action.VIEW dat=content://com.android.contacts/data/6792 cmp=android/com.android.internal.app.ResolverActivity }
我尝试了几种 Intent 过滤器的组合,例如:
<intent-filter>
<action android:name=”android.intent.action.View” />
<category android:name=”android.intent.category.DEFAULT” />
<category android:name=”android.intent.category.BROWSABLE” />
<data android:scheme=”geo” />
</intent-filter>
<intent-filter>
<action android:name=”android.intent.action.View” />
<category android:name=”android.intent.category.DEFAULT” />
<category android:name=”android.intent.category.BROWSABLE” />
<data android:scheme=”content” android:host=”com.android.contacts” android:pathPattern=”/data/*” />
</intent-filter>
最佳答案
在 ICS 中你应该使用这个:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="geo" />
</intent-filter>
应相应地(不同地)处理收到的 Intent 。 请注意,在 ICS 上并使用此 Intent 过滤器,您不需要特殊权限即可读取联系地址。
关于android - 用于处理联系人中的地址新闻的 Intent 过滤器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4890797/