Steve wrote:
> Hi.  What is the recommended way to launch the messaging app (for
> sending an MMS message) via an intent? 

There is no way to launch specifically the Messaging app that is covered
in the SDK.

> The following code works on my
> HTC Magic ...
> 
>     Intent intent = new Intent(Intent.ACTION_SEND);
>     intent.putExtra("address", "0215555555");
>     intent.putExtra("sms_body", "my message text");
>     intent.putExtra(Intent.EXTRA_STREAM, imageUri); // imageUri set
> previously
>     intent.setType("image/jpeg");
>     startActivity(intent);
> 
> ... but it first launches the Resolver activity
> (com.android.internal.app.ResolverActivity), prompting the user to
> select the appropriate app (Email, Gmail, Messaging, Picasa).  The
> user has to select Messaging before proceeding.

Precisely! After all, they might also choose another SMS client as well.

> The only way I've found to bypass the resolver is to explicity set the
> desired component on the intent before starting the activity as
> follows:
> 
>     intent.setClassName("com.android.mms",
> "com.android.mms.ui.ComposeMessageActivity");
> 
> However, I'm guessing this approach will not work on devices that have
> a customised UI, like the HTC Hero.  Can someone confirm/deny?

It is not part of the SDK and therefore is likely to break on select
devices or in future versions of Android. It also may not use the user's
preferred SMS client.

> I'm also struggling to find official documentation for the "address"
> and "sms_body" fields that can be supplied as extra data as per the
> above example. 

They are not documented. The only documented extras for ACTION_SEND are
EXTRA_TEXT, EXTRA_STREAM, EXTRA_EMAIL, EXTRA_CC, EXTRA_BCC, and
EXTRA_SUBJECT (all public static data members on the Intent class).

http://developer.android.com/reference/android/content/Intent.html#ACTION_SEND

> Is it expected that these will be supported by the
> default messaging app in future SDK versions and in customised UIs
> (like HTC's Sense UI)?

I would not expect that at all.

Either send the SMS yourself (via SmsManager) or don't assume SMS is the
desired messaging mechanism -- just offer an ACTION_SEND without an
address and let the user send whatever it is they want to whoever they
want however they want. Heck, for you know, the user would prefer to
post whatever it is on their Twitter account, which they can do via
ACTION_SEND if they have Twidroid installed (or other Twitter clients
that implement ACTION_SEND support, if any).

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android App Developer Training: http://commonsware.com/training
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to