Search code examples
androidsmsgoogle-voice

Sending an SMS using Google Voice


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);

Solution

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