Intent-filter:如何仅接受 "text/plain" 个包含单词 "spaghetti" 的意图
Intent-filter: How to accept only "text/plain" intents containing the word "spaghetti"
我的应用程序是关于意大利面条的,它应该允许您分享任何 text/plain
内容,前提是它是关于意大利面条的。所以我需要一个只接受此类内容的 intent-filter。
如果有帮助,这些是意大利面条示例:
不幸的是,我只找到了一种接受 text/plain
内容的方法,但我找不到任何 in the docs 可以通过文本本身进行过滤的内容。
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
这可能吗?欢迎解决方法。
Is this possible at all?
没有
Workarounds are welcome.
接受所有文本,如果文本不包含对合适面食产品的引用,则显示错误,并可能 finish()
您的 activity 到 return 用户到他们来的任何地方来自.
您可以发明自己的 MIME 类型(例如,application/vnd.cprcrack.al.dente
),但由于大约有零个其他应用程序将使用该 MIME 类型共享内容,因此用户会很饿。
我的应用程序是关于意大利面条的,它应该允许您分享任何 text/plain
内容,前提是它是关于意大利面条的。所以我需要一个只接受此类内容的 intent-filter。
如果有帮助,这些是意大利面条示例:
不幸的是,我只找到了一种接受 text/plain
内容的方法,但我找不到任何 in the docs 可以通过文本本身进行过滤的内容。
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
这可能吗?欢迎解决方法。
Is this possible at all?
没有
Workarounds are welcome.
接受所有文本,如果文本不包含对合适面食产品的引用,则显示错误,并可能 finish()
您的 activity 到 return 用户到他们来的任何地方来自.
您可以发明自己的 MIME 类型(例如,application/vnd.cprcrack.al.dente
),但由于大约有零个其他应用程序将使用该 MIME 类型共享内容,因此用户会很饿。