Android以编程方式发送彩信?

时间:2014-04-24 11:58:21

标签: android mms

我正在尝试以语法方式发送mms这是我的代码

ntent sendIntent = new Intent(Intent.ACTION_SEND); 
            sendIntent.setClassName("com.android.mms", "com.android.mms.ui.ComposeMessageActivity");
            //sendIntent.setType("vnd.android-dir/mms-sms");
            sendIntent.putExtra("exit_on_sent", true);
            sendIntent.putExtra("address", sendingnumbeer);
            sendIntent.putExtra("sms_body", "Sample");   
            File dir = new File("/sdcard/VinstantMessage/");

            String path=dir.getAbsolutePath()+"/abc.mp4";
            File fl=new File(path);
            if(fl.exists()){
                System.out.println("file is exist");
            }
            Uri uri = Uri.fromFile(fl);
            sendIntent.putExtra(Intent.EXTRA_STREAM, uri);
            sendIntent.setType("video/*"); 
            sendIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
           // getApplicationContext().startActivity(sendIntent);
            startActivityForResult(sendIntent, 1);

它正在打开发送mms窗口,但我无法让用户点击发送mms或不?我怎么能检查这个

由于

1 个答案:

答案 0 :(得分:0)

好的我已经解决了我正在添加" sendIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)的问题;"

删除此行,它将正常运作

感谢