如何拦截谷歌地图意图的Andr​​oid? [英] How intercept a google maps intent in Android?

查看:141
本文介绍了如何拦截谷歌地图意图的Andr​​oid?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图拦截谷歌地图的意图如下:

I was trying to intercept a google maps intent as the following:

意图myIntent =新的意图(android.content.Intent.ACTION_VIEW,Uri.parse(GEO:37.423156,-122.084917));

Intent myIntent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("geo:37.423156,-122.084917"));

但我还没有发现任何这例子,链接或文件。所以,我在想,很不幸是不可能​​的。

but I haven't found any example, link or documentation of this. So, I'm thinking that unfortunately is not possible.

在清单文件,我把几个意图过滤器。特别我认为未来意图过滤器必须具有上述意图相匹配。

In the Manifest file I put several intent filters. Specially I think that the next intent filter must match with the mentioned intent.

<intent-filter>
<action android:name="android.content.Intent.ACTION_VIEW" />
        <data android:scheme="geo"/>
    </intent-filter>

此外,我想调查什么活动,这个特别的意图通过以下方式匹配:

In addition I tried to investigate what activities match with this particular intent by means of:

List resolves = getPackageManager().queryIntentActivities(myIntent, 0 );
ResolveInfo firstRevolve=(ResolveInfo) resolves.get(0);
IntentFilter myIF=firstRevolve.filter;

不过只有MapsActivity的意图,不是我的活动相匹配,而令人惊讶的myIF为空,所以我不能够获得谷歌地图活动使用的意图过滤器。

Nevertheless only MapsActivity matches with the intent, not my Activity, and surprisingly myIF is null, so that I can't obtain the intent filter that the google maps activity uses.

此外,我从Android Market安装意图拦截,但它并没有抓住这个意图。

In addition I installed "Intent Intercept" from Android Market, but it does not capture this intent.

所以,我需要一些帮助/想法。有人知道发生了什么事?在我看来,谷歌规定,本次拦截,但没有规定此限制。

So, I need some help/idea. Somebody knows what is happening? In my opinion Google restricts this interceptions but this restriction is not specified.

任何帮助将AP preciated。 诚挚的问候, 巴勃罗。

Any help will be appreciated. Best regards, Pablo.

推荐答案

在code下面的例子仅仅是工作的罚款在我的项目。

The code example below is just working fine in my project.

<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="https" android:host="maps.google.com" />
    <data android:scheme="geo" />
</intent-filter>

这篇关于如何拦截谷歌地图意图的Andr​​oid?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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