上篇提到下行彩信到MMSC,其中消息体还为提及,
MMContent content = new MMContent(); // 继承该类
/**设置附件的类型,若不包含 SMIL格式的文件,则设置类型为 MMConstants.ContentType. MULTIPART_MIXED,若包含 SMIL格式的文件,则设置类型为 MMConstants.ContentType. MULTIPART_RELATED*/
content.setContentType(MMConstants.ContentType. MULTIPART_MIXED);
/**添加类型为 Gif的附件一 */
MMContent sub1 = MMContent.createFromFile("f://yellow.gif");
sub1.setContentID("1.gif"); //可以不设
/**设置子附件的类型,有两种设置方式:一种是在 setContentType里面填写 MMConstants.ContentType里面定义的常量,另一种是在 setContentType里面填写一个 String的类型,如 text/plain等。 */
sub1.setContentType(MMConstants.ContentType.GIF); // 一定要设置
content.addSubContent(sub1);
/**添加类型为 Txt的附件二 */
MMContent sub2 = MMContent.createFromString("This is a Test2!");
sub2.setContentType(MMConstants.ContentType. TEXT); //一定要设置
sub2.setContentID("2.txt");
content.addSubContent(sub2);
/**将附件进行设置,设需发送消息为 MM7SubmitReq*/
submitReq.setContent(content);
MMContent content = new MMContent(); // 继承该类
/**设置附件的类型,若不包含 SMIL格式的文件,则设置类型为 MMConstants.ContentType. MULTIPART_MIXED,若包含 SMIL格式的文件,则设置类型为 MMConstants.ContentType. MULTIPART_RELATED*/
content.setContentType(MMConstants.ContentType. MULTIPART_MIXED);
/**添加类型为 Gif的附件一 */
MMContent sub1 = MMContent.createFromFile("f://yellow.gif");
sub1.setContentID("1.gif"); //可以不设
/**设置子附件的类型,有两种设置方式:一种是在 setContentType里面填写 MMConstants.ContentType里面定义的常量,另一种是在 setContentType里面填写一个 String的类型,如 text/plain等。 */
sub1.setContentType(MMConstants.ContentType.GIF); // 一定要设置
content.addSubContent(sub1);
/**添加类型为 Txt的附件二 */
MMContent sub2 = MMContent.createFromString("This is a Test2!");
sub2.setContentType(MMConstants.ContentType. TEXT); //一定要设置
sub2.setContentID("2.txt");
content.addSubContent(sub2);
/**将附件进行设置,设需发送消息为 MM7SubmitReq*/
submitReq.setContent(content);