How to pass text to Google Voice SMS Programmatically?
I use the following code to start the SMS application:
Intent smsIntent=new Intent(Intent.ACTION_SENDTO, Uri.parse("sms:"));
smsIntent.putExtra("sms_body", "Message Body");
startActivity(smsIntent);
It works fine if user selects standard "Messaging" application. But if user selects GV the message body text is ignored.开发者_Go百科
I have also tried the following as suggested in some forums:
smsIntent.putExtra(Intent.EXTRA_TEXT, "Message Body");
I have searched all the forums I know of and tried lot of things. Nothing worked for me. Am I missing something here? Does GV need a special handing that it can’t be treated as regular “Messaging” app?
Here are some thoughts that might point you in the right direction:
- Google Voice SMS intent
- Sending SMS using Intent does not add recipients on some devices
what is the difference between ACTION_SENDTO and ACTION_VIEW when sending sms?
Here's a third party library for accessing Google Voice: http://code.google.com/p/google-voice-java/ ...except it directly accesses Google Voice via its web URLs...
Here's some old (2010) Android MMS source where they manually accessed Google Voice, which might give some bonus hints:
Also try putting it in an extra called
"data"
or"pdudata"
Also, here's some more (old?) source mentioning some intent extras including
"android.mms.extra.MESSAGE"
Hopefully one of these help you out...
精彩评论