【问题标题】:send a photo through MMS message通过彩信发送照片
【发布时间】:2017-08-28 22:54:50
【问题描述】:

我正在尝试通过彩信发送照片,我正在使用以下已知的 sn-p

Intent i = new Intent(Intent.ACTION_SEND);
i.putExtra(Intent.EXTRA_TEXT, "This is an MMS message");
String sendfilepath = "file://" + sendfile.toString() + ".jpg";
i.putExtra(Intent.EXTRA_STREAM,Uri.parse(sendfilepath)) ;
i.setType("image/jpeg");

它适用于我的索尼设备。弹出菜单显示消息应用程序以及其他应用程序。 但是对于 HTC,它不会显示消息应用程序。它显示蓝牙、Facebook、邮件等。我怎样才能让它在“使用完成操作”列表中显示消息应用程序

【问题讨论】:

    标签: android sms mms


    【解决方案1】:

    您可以使用此技术检查 HTC 感应设备并做出适当反应以发送正确的“版本”意图。

    Uri uri = Uri.fromFile(imgFile);
    //HTC Sense intent
    Intent sendIntent = new Intent("android.intent.action.SEND_MSG");
    sendIntent.putExtra(Intent.EXTRA_STREAM, uri);
    sendIntent.setType("image/"+type);
    List<ResolveInfo> resolves = getPackageManager().queryIntentActivities(sendIntent,PackageManager.MATCH_DEFAULT_ONLY);
    if (resolves.size() > 0) {
        // This branch is followed only for HTC 
        startActivity(sendIntent);
    } else {
        // Else launch the non-HTC sense Intent
        sendIntent = new Intent(Intent.ACTION_SEND);
        sendIntent.putExtra(Intent.EXTRA_STREAM, uri);
        sendIntent.setType("image/"+type);
        startActivity(Intent.createChooser(sendIntent,"Send"));
    }
    

    【讨论】:

    • 它会打开消息应用程序,但不会附加图像。 +类型是什么意思?我把 (image/jpeg) 放错了吗?
    • 这将是您的图像是什么类型的文件,在我的应用程序中,我有一些不同类型的图像(png、jpeg 等),所以我必须使其具有动态性。如果您只有 jpeg,那么您应该可以使用 "image/jpeg"
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-12-21
    • 2017-06-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多