2 Replies Latest reply: Apr 22, 2011 1:14 PM by Anshul RSS

    Making call

    839445
      Hows to make call using a JME application.. Thanks in advance..
        • 1. Re: Making call
          845562
          hi,you can use javax.microedition.midlet.MIDlet.platformRequest().
          String number = "tel:<tele number>";
          platformRequest(number);

          Edited by: 842559 on Mar 7, 2011 10:58 PM
          • 2. Re: Making call
            Anshul
            here is an example try this code its working..


            import javax.microedition.io.ConnectionNotFoundException;
            import javax.microedition.lcdui.Command;
            import javax.microedition.lcdui.CommandListener;
            import javax.microedition.lcdui.Display;
            import javax.microedition.lcdui.Displayable;
            import javax.microedition.lcdui.Form;
            import javax.microedition.lcdui.TextField;
            import javax.microedition.midlet.*;
            import javax.microedition.midlet.MIDlet.*;

            /**
            * @author anshul
            */
            public class Call extends MIDlet implements CommandListener {

            private TextField tx;
            private String numberString;
            private Command Exit;
            private Command call;
            private Form form;
            public void startApp() {

            tx = new TextField("Please enter the number:", numberString, 12, TextField.PHONENUMBER);
            Exit= new Command("Exit",Command.EXIT, 0);
            call = new Command("call",Command.SCREEN, 1);
            form = new Form("call a number");
            form.append(tx);
            form.addCommand(call);
            form.addCommand(Exit);
            form.setCommandListener(this);
            Display.getDisplay(this).setCurrent(form);

            }

            public void pauseApp() {
            }

            public void destroyApp(boolean unconditional) {
            }

            public void commandAction(Command c, Displayable d) {

            if(c==call)
            {
            System.out.println(tx.getString());
            try {
            System.out.println(tx.getString());
            platformRequest("tel:" + tx.getString());
            System.out.println("called");
            } catch (ConnectionNotFoundException ex) {
            ex.printStackTrace();
            }
            }

            }
            }