如何使用意图过滤器捕捉的Andr​​oid份额意图仅限于特定的网址?意图、过滤器、如何使用、份额

2023-09-06 13:52:05 作者:陪你到天亮

我可以使用下面的意图过滤器钩我的应用程序进入共享页面功能:

 <意向滤光器>
  <作用机器人:名称=android.intent.action.SEND/>
  <类机器人:名称=android.intent.category.DEFAULT/>
  <数据机器人:MIMETYPE =text / plain的/>
 

不过,我想远一点去限制过滤器意图与他们特定的网址,为YouTube视频的URL示例。我想是这样的,但它不工作:

 <意向滤光器>
  <作用机器人:名称=android.intent.action.SEND/>
  <类机器人:名称=android.intent.category.DEFAULT/>
  <数据
    机器人:MIMETYPE =text / plain的
    机器人:计划=HTTP
    机器人:主机=m.youtube.com
  />
 

有什么建议?

解决方案   

不过,我想远一点去限制过滤器意图与他们特定的网址,为YouTube视频的URL示例。

你所要求的无感让我为写。

也许你真的是:

  

不过,我想远一点去限制过滤器ACTION_SEND提出的申请体内多余包含特定网址

在这种情况下,这是不可能的,对不起。

或者,也许你真的是:

  

不过,我想远一点去限制过滤器ACTION_SEND这种情况发生特定的URL来思考的时候用户碰巧preSS分享从随机件软件发出的请求,如分享当前的YouTube视频播放的YouTube应用程序

在这种情况下,这是不可能的,对不起。

如果没有这些猜测真的打你所要求的,请考虑编辑你的问题。

I can hook my app into the "Share page" feature using the following intent-filter:

<intent-filter>
  <action android:name="android.intent.action.SEND" />
  <category android:name="android.intent.category.DEFAULT" />
  <data android:mimeType="text/plain" />

But I would like to go a little further and limit the filter to intents with specific URLs in them, for example URL of a YouTube video. I tried something like this but it doesn't work:

<intent-filter>
  <action android:name="android.intent.action.SEND" />
  <category android:name="android.intent.category.DEFAULT" />
  <data
    android:mimeType="text/plain"
    android:scheme="http"
    android:host="m.youtube.com"
  />

Any suggestions?

解决方案

But I would like to go a little further and limit the filter to intents with specific URLs in them, for example URL of a YouTube video.

What you are asking for makes no sense to me as written.

Perhaps you really mean:

But I would like to go a little further and limit the filter to ACTION_SEND requests where the body extra contains a specific URL

In which case, that is impossible, sorry.

Or, perhaps you really mean:

But I would like to go a little further and limit the filter to ACTION_SEND requests issued from random pieces of software that happen to be thinking of a specific URL at the time user happened to press "share", such as sharing the current YouTube video being played in the YouTube app

In which case, that is impossible, sorry.

If neither of those guesses really hit what you are asking for, please consider editing your question.

 
精彩推荐
图片推荐