简体   繁体   English

Android - 启动 Google Voice 应用程序并拨打号码

[英]Android - Launch Google Voice app and dial number

We are working on an Android tablet-only app.我们正在开发一款仅适用于 Android 平板电脑的应用程序。 We need to be able to launch the Google Voice app for a certain telephone number programmatically.我们需要能够以编程方式为某个电话号码启动 Google Voice 应用程序。

We tried this (which it would probably work to launch the phone if our app wasn't running on a tablet), but it did not work:我们尝试了这个(如果我们的应用程序不在平板电脑上运行,它可能会启动手机),但它不起作用:

var intent = new Intent (Intent.ActionView);
string uri = "tel:" + number;
intent.SetData (Uri.Parse (uri));
activity.StartActivity (intent);

Code ported from Java here . 在此处从 Java 移植的代码。

All it does is popup a box to add the number to a contact--which is not what we want.它所做的只是弹出一个框来将号码添加到联系人——这不是我们想要的。

Any ideas?有任何想法吗? We can't find any examples online of doing this, and I'm sure it would use a completely different url scheme, etc.我们无法在网上找到任何这样做的例子,而且我确信它会使用完全不同的 url 方案等。

  • NOTE: our app is Mono for Android, but Java answers will work for us just as well注意:我们的应用程序是适用于 Android 的 Mono,但 Java 答案也适用于我们

From my examination of Google Voice, I doubt that this is possible.根据我对 Google Voice 的检查,我怀疑这是可能的。 It certainly is not supported -- they offer no activities with any likely that fits your needs.它当然不受支持——他们不提供任何可能满足您需求的活动。

can you post a little more info on how you looked at the intent-filter of an existing app?你能发布更多关于你如何看待现有应用程序的 intent-filter 的信息吗?

There is a handy app on the Play Store called AppXplore , from Sony. Play Store 上有一个来自索尼的名为AppXplore的便捷应用程序。 It lets you inspect various details about installed apps, including having it effectively regenerate the manifest from data held in PackageManager .它允许您检查有关已安装应用程序的各种详细信息,包括让它从PackageManager中保存的数据有效地重新生成清单。

So, I installed Google Voice and examined it in AppXplore, sifting through all the activities (there's a zillion of 'em) for interesting <intent-filter> elements.因此,我安装了 Google Voice 并在 AppXplore 中对其进行了检查,筛选了所有活动(有无数的活动)以寻找有趣<intent-filter>元素。 I was a bit surprised that they didn't offer a tel: filter, and I didn't see anything else likely to be relevant.我有点惊讶他们没有提供tel:过滤器,而且我没有看到任何其他可能相关的东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM