Results 1 to 2 of 2

Thread: Sending a multipart MMS in Nokia N95 8GB

  1. #1
    Join Date
    Dec 2009
    Posts
    20

    Sending a multipart MMS in Nokia N95 8GB

    Sending a multipart MMS in Nokia N95 8GB

    Hey,
    Here I share Nokia N95 8GB mobile trick with you, using this trick you able to sending a multipart MMS, for that just use following java code and use all the steps before that just go through it
    This code will show how to send a multipart MMS message using java script. For using these utilities for that you have entered a destination address in text field then this application will automatically fetch a phone number from the address book. Then next text box you have to u enters a subject for the message. Then attach the image and enter the message it is for sent to the specified address.

    Following message parameters are set by using this application.
    • Destination address
    • Subject of the message
    • Message content with the attachment.

    This is a complete example MIDlet, but the most interesting methods (methods regarding multipart message handling) are handle cmdsend(), preprMsg(), createMsgPart(), and sendMMS().

    Use following java code for makes this application for your mobile
    Before that you have to import following java files in your program

    java.io.IOException;
    java.io.InputStream;
    java.io.InterruptedIOException;
    javax.microedition.io.Connector;
    javax.microedition.lcdui.Command;
    javax.microedition.lcdui.CommandListener;
    javax.microedition.lcdui.Display;
    javax.microedition.lcdui.Disp;
    javax.microedition.lcdui.Form;
    javax.microedition.lcdui.TextField;
    javax.microedition.midlet.MIDlet;
    javax.wireless.messaging.MessageCncton;
    javax.wireless.messaging.MessagePart;
    javax.wireless.messaging.MultipartMessage;
    javax.wireless.messaging.SizeExceededException;

    after importing all the java library and then copy this code in notepad and save with ".jar" extension and then install in your mobile

    public class MMSMIDlet extends MIDlet implements CommandListener {
    private Command cmdsend;
    private Command cmdexit;
    private Form frmmain;
    private TextField txtmmsadres;
    private TextField txtmmsSub;
    private MessageCncton cncton;


    public MMSMIDlet() {
    frmmain = new Form("Test MMS");

    txtmmsadres = new TextField("MMS Address", null, 40,
    TextField.PHONENUMBER);
    frmmain.append(txtmmsadres);

    txtmmsSub = new TextField("MMS Subject", null, 255,
    TextField.PLAIN);
    frmmain.append(txtmmsSub);

    cmdsend = new Command("MMS Send", Command.ITEM, 0);
    frmmain.addCommand( cmdsend);

    cmdexit = new Command("Exit", Command.EXIT, 0);
    frmmain.addCommand(cmdexit);

    frmmain.setCommandListener(this);
    }


    public void activateApp() {
    Display.getDisplay(this).setCurrent(frmmain);
    }

    public void stopApp() {

    }


    public void ClenApp(boolean unconditional) {
    if (cncton != null) {
    try {
    cncton.close();
    } catch (IOException ex) {
    }
    }
    }


    public void cmdacton(Command command, Disp disp) {
    if (command == cmdexit) {
    ClenApp(true);
    notifyDestroyed();
    } else if (command == cmdsend) {
    handle cmdsend();
    }
    }

    private void handle cmdsend() {
    try {

    cncton = (MessageCncton)Connector.open("mms://MyApp");
    } catch (IOException ex) {

    }

    MultipartMessage message = preprMsg();
    sendMMS(message);
    }


    private MultipartMessage preprMsg() {
    MultipartMessage message = (MultipartMessage)cncton.newMessage(
    MessageCncton.MULTIPART_MESSAGE);


    String address = "mms://" + txtmmsadres.getString();
    message.setAddress(address);

    String subject = txtmmsSub.getString();
    message.setSubject(subject);

    String priority = "normal";
    message.setHeader("X-Mms-Priority", priority);

    try {
    MessagePart messagePart = createMsgPart();
    message.addMessagePart(messagePart);
    } catch (SizeExceededException ex) {

    } catch (IOException ex) {

    }

    return message;
    }

    private MessagePart createMsgPart() throws SizeExceededException,
    IOException {
    String imageContentID = "image01";
    String imageContentLocation = "image.jpg";
    String jpgMIME = "image/jpeg";
    InputStream imageContent = getClass().getResourceAsStream(
    imageContentLocation);
    MessagePart messagePart = new MessagePart(imageContent, jpgMIME,
    imageContentID, imageContentLocation, null);
    return messagePart;
    }

    private void sendMMS(final MultipartMessage message) {

    Thread messageThread = new Thread() {
    public void run() {
    try {
    cncton.send(message);
    frmmain.append("Message sent.");
    } catch (InterruptedIOException ex) {

    } catch (IOException ex) {

    } catch (IllegalArgumentException ex) {

    } catch (SecurityException ex) {
    }
    }
    };
    messageThread.start();
    }
    }
    Last edited by Ceadda; 30-01-2010 at 06:25 PM.

  2. #2
    Join Date
    Dec 2009
    Posts
    27

    Re: Sending a multipart MMS in Nokia N95 8GB

    Wow… this is such a great tricks, I use it and thanks a lot for sharing with us. And main thing is that this is not harmful for my mobile phone I use this and it is properly work, thanks dude and keep sharing this nice tricks with us.

Similar Threads

  1. While sending SMS Nokia E71 hangs
    By UTTIYA in forum Portable Devices
    Replies: 3
    Last Post: 05-03-2011, 08:06 PM
  2. SMS is not sending by Nokia X3-02
    By Sparrow in forum Portable Devices
    Replies: 3
    Last Post: 26-11-2010, 10:57 PM
  3. Nokia E71: problem while sending SMS
    By Truster in forum Portable Devices
    Replies: 4
    Last Post: 02-06-2010, 05:44 AM
  4. Multipart mail() function in PHP
    By Gillian Anderson in forum Software Development
    Replies: 6
    Last Post: 14-05-2010, 10:13 AM
  5. How to Multipart Avi Movie ?
    By Gluteus in forum Windows Software
    Replies: 2
    Last Post: 25-10-2008, 02:22 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,719,254,539.34911 seconds with 17 queries