意图过滤器:如何只接受" text / plain的"面条"包含单词QUOT意图; [英] Intent-filter: How to accept only "text/plain" intents containing the word "spaghetti"

查看:151
本文介绍了意图过滤器:如何只接受" text / plain的"面条"包含单词QUOT意图;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序是关于意大利面条,它应该让你分享任何文本/纯提供的内容是关于意大利面条。所以,我需要一个意图过滤器只接受这些内容。

在情况下,它可以帮助,这些都是意大利面条为例:

不幸的是,我只找到一个办法接受文本/纯的内容,但我找不到任何的在文档通过文本本身进行过滤。

 <意向滤光器>
    <作用机器人:名字=android.intent.action.SEND/>
    <类机器人:名字=android.intent.category.DEFAULT/>
    <数据机器人:mime类型=text / plain的/>
&所述; /意图滤光器>

这是可能的呢?解决方法是受欢迎的。


解决方案

  

这是可能的呢?


没有。


  

变通方法是受欢迎的。


接受所有的文本,如果文本中不包含适合面食制品的引用文件,显示一个错误,可能完成()您的活动来回报用户无论他们在哪里是从哪里来的。

您可以发明自己的MIME类型(例如,应用程序/ vnd.cprcrack.al.dente ),但由于接近零的其他应用程序将与MIME可以共享的东西类型,用户将获得饿了。

My app is about spaghetti, and it should allow you to share any text/plain content provided it's about spaghetti. So I need an intent-filter that accepts only such content.

In case it helps, these are example spaghetti:

Unfortunately, I only found a way to accept text/plain content, but I couldn't find anything in the docs to filter via the text itself.

<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.

解决方案

Is this possible at all?

No.

Workarounds are welcome.

Accept all text, and if the text does not contain references to suitable pasta products, show an error and possibly finish() your activity to return the user to wherever they came from.

You could invent your own MIME type (e.g., application/vnd.cprcrack.al.dente), but since approximately zero other apps will be sharing things with that MIME type, the user will get hungry.

这篇关于意图过滤器:如何只接受&QUOT; text / plain的&QUOT;面条&QUOT;包含单词QUOT意图;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆