Android: Is there a universal way to send the MMS on any android devices?
Asked Answered
P

3

24

This code works on the plain google devices with native android system. But there is no MMS app in the list on htc sense devices and I don't know about Motorola Blur etc.:

    final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
    emailIntent.setType("image/png");
    emailIntent.putExtra(Intent.EXTRA_STREAM, uri);
    context.startActivity(Intent.createChooser(emailIntent, context.getString(R.string.send_intent_name)));

This code works on the htc sense but not from the Chooser, what I really need:

    Intent sendIntent = new Intent("android.intent.action.SEND_MSG");
    sendIntent.putExtra(Intent.EXTRA_STREAM, uri);
    sendIntent.setType("image/png");
    context.startActivity(sendIntent);

But I don't know how to combine this code samples together and I don't know how to determine Htc Sense ui programmatically. Is it right way to support different type of devices?

Thank you for answers.

Plumage answered 2/6, 2010 at 9:40 Comment(1)
Have you seen [this question][1]? It has some sample code. [1]: #2973345Tuberose
F
1

Sense, especially the older versions are a pain. There webview control also has a bunch of problems. Depending on volume of messages you might try using a webservice like amazon's simple notification service to send sms messages: http://aws.typepad.com/aws/2011/11/amazon-simple-notification-service-now-supports-sms.html Its not an android solution, but it might work.

Fidel answered 4/11, 2011 at 12:22 Comment(0)
F
1

You could detect whether there's a responder for the HTC Intent, and then branch:

intent = new Intent("android.intent.action.SEND_MSG");
intent.putExtra(Intent.EXTRA_STREAM, uri);
intent.setType("image/png");

resolves = getActivity().getPackageManager().queryIntentActivities(intent,
        PackageManager.MATCH_DEFAULT_ONLY);

if (resolves.size() > 0) {
    // This branch is followed only for HTC 
    context.startActivity(intent);
} else {
    // Else launch the non-HTC sense Intent
    intent = new Intent(android.content.Intent.ACTION_SEND);
    intent.setType("image/png");
    intent.putExtra(Intent.EXTRA_STREAM, uri);
    context.startActivity(Intent.createChooser(intent,
            context.getString(R.string.send_intent_name)));    
}
Farrish answered 7/11, 2011 at 2:45 Comment(1)
I am doing something similar HERE!!! #14453308Boydboyden
R
1

You may use it like this:

Intent i = new Intent(Intent.ACTION_SEND);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i.putExtra(Intent.EXTRA_EMAIL, new String[]{""});
i.setType("video/3gp");
i.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + attachmentFilePath));
startActivity(i);
Riot answered 16/11, 2011 at 13:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.