使用 Google 语音发送短信
我有一个应用程序,我需要能够发送短信。我有直接发送它们的代码,但我想为没有消息计划的用户提供使用 Google Voice 的选项。有谁知道该怎么做?我好像找不到路了这是我现在正在做的方式:
StringBuffer buffer = new StringBuffer();
buffer.append("GEOC ");
buffer.append(mLogType.getSelectedItemPosition() == 0 ? "@" : "x");
buffer.append(mGeocache.getWaypoint()).append(" ");
if(mLogEdit.getText().length() > 0)
{
buffer.append(mLogEdit.getText().toString());
}
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage("41411", null, buffer.toString(), null, null);
I have an app where I need to be able to send SMS messages. I have the code to send them directly, but I would like to give the option to use Google Voice to users who don't have messaging plans. Does anyone know how to do this? I can't seem to find the way. Here is the way I am doing it now:
StringBuffer buffer = new StringBuffer();
buffer.append("GEOC ");
buffer.append(mLogType.getSelectedItemPosition() == 0 ? "@" : "x");
buffer.append(mGeocache.getWaypoint()).append(" ");
if(mLogEdit.getText().length() > 0)
{
buffer.append(mLogEdit.getText().toString());
}
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage("41411", null, buffer.toString(), null, null);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您想要使用 SMS Intent。
这将为用户提供选择(或者如果已经有默认选项则跳过此步骤)他想要使用的 SMS 发送实用程序的选项。
一些应用程序如此注册,例如 Skype、Yahoo Hub、Google Voice 等。
因此,使用 Intent,您可以告诉 Android 使用用户想要将文本消息发送给 SMS 收件人的任何内容。
You want to use an SMS Intent.
That will give the user the option to select (or skip this step if he already have a default option) which SMS sending utility he want's to use.
several applications register themselves as such, such as skype, yahoo hub, google voice, etc.
So using a Intent, you tell android to use whatever the user wants to send the text message to a sms recipient.
我相信用户必须设置谷歌语音帐户并安装语音应用程序。然后,当您发出发送短信的意图时,他们将优先选择是否使用谷歌语音。
It's my belief that the user must have a google voice account setup and have the voice app installed. Then when you fire an intent to send an sms it will be their preference to use google voice or not.
我找到了一个网站,他们编写了自己的谷歌语音 Java 库,您可以将其导入到您的应用程序中并使用。我昨天刚下载,所以还无法提供具体帮助,但请继续看一下。看起来确实很有前途。
http://code.google.com/p/google-voice-java/
I've found a site where they've written their own google voice java library that you can import into your app and use. I just downloaded it yesterday so can't help with specific yet, but go ahead and take a look. It looks really promising.
http://code.google.com/p/google-voice-java/