Flutter for Android developers文档解释了如何使Flutter应用程序接受传入的Android意图,并给出了接受 Share 意图的代码示例。我已经复制了它,效果很好。
但是我现在正在尝试让我的应用接受其他类型的意图,特别是编辑联系人意图,以便在我使用默认的Phone应用并单击在联系人上,建议我的应用程序完成操作。
我尝试了在谷歌搜索和搜索GitHub后可以找到的<intent-filter>
的所有可能组合,但是没有任何方法可以使它工作。列举一些:
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="vnd.android.cursor.item/person"/>
<data android:mimeType="vnd.android.cursor.item/contact"/>
<data android:mimeType="vnd.android.cursor.item/raw_contact"/>
<data android:mimeType="vnd.android.cursor.item/phone"/>
<data android:mimeType="vnd.android.cursor.item/phone_v2"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.GET_CONTENT"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="vnd.android.cursor.item/person" android:host="contacts"/>
<data android:mimeType="vnd.android.cursor.item/contact" android:host="contacts"/>
<data android:mimeType="vnd.android.cursor.item/raw_contact" android:host="contacts"/>
</intent-filter>
<intent-filter >
<action android:name="android.intent.action.EDIT" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="contacts"
android:mimeType="vnd.android.cursor.item/person" />
<data
android:host="com.android.contacts"
android:mimeType="vnd.android.cursor.item/contact" />
<data
android:host="com.android.contacts"
android:mimeType="vnd.android.cursor.item/raw_contact" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.APP_CONTact"/>
</intent-filter>
etc.
我在做什么错了?