Question

The code below works:

import javax.microedition.io.*;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;
import javax.wireless.messaging.*;
/**
 * @author Panda
 */
public class Midlet extends MIDlet implements CommandListener {
      Display display;
      private TextField toWhom;
      private TextField message;
      private Alert alert;
      private Command send,exit;
      MessageConnection clientConn;
      private Form compose;
      TextMessage textmessage;

      public void startApp() {
            display=Display.getDisplay(this);
            compose=new Form("Compose Message");
            toWhom=new TextField("To","",10,TextField.PHONENUMBER);
            message=new TextField("Message","",600,TextField.ANY);
            send=new Command("Send",Command.BACK,0);
            exit=new Command("Exit",Command.SCREEN,5);
            compose.append(toWhom);
            compose.append(message);
            compose.addCommand(send);
            compose.addCommand(exit);
            compose.setCommandListener(this);
            display.setCurrent(compose);
      }
      public void pauseApp() {
      }
      public void destroyApp(boolean unconditional) {
            notifyDestroyed();
      }
      public void commandAction(Command cmd,Displayable disp) {
            if(cmd==exit) {
                  destroyApp(false);
            }
            if(cmd==send) {
                  String mno=toWhom.getString();
                  String msg=message.getString();
                  if(mno.equals("")) {
                        alert = new Alert("Alert");
                        alert.setString("Enter Mobile Number!!!");
                        alert.setTimeout(2000);
                        display.setCurrent(alert);
                  }
                  else {
                        try {
                              clientConn=(MessageConnection)Connector.open("sms://"+mno);
                        }
                        catch(Exception e) {
                              alert = new Alert("Alert");
                              alert.setString("Unable to connect to Station because of network problem");
                              alert.setTimeout(2000);
                              display.setCurrent(alert);
                        }
                        try {
                              textmessage = (TextMessage) clientConn.newMessage(MessageConnection.TEXT_MESSAGE);
                              textmessage.setAddress("sms://"+mno);
                              textmessage.setPayloadText(msg);
                              clientConn.send(textmessage);                              
                        }
                        catch(Exception e)
                        {
                              alert=new Alert("Alert","",null,AlertType.INFO);
                              alert.setTimeout(Alert.FOREVER);
                              alert.setString(e.getMessage());
                              display.setCurrent(alert);
                        }
                  }
            }
      }
}

I am able to send text messages using this midlet but the only problem is that my phone Nokia n85 wont let me send the message without me pressing OK on an sms send security warning. What i want to achieve is to be able to bypass this security measure programatically by giving the application higher priviledges perhaps ? How do i do that? I just don't want this security notification to pop up next time i press the send button. I have tried to set the API permissions in Netbeans for the JAD and added these:

javax.microedition.io.Connector.sms
javax.wireless.messaging.sms.send

But that is not enough to bypass it. Any Ideas anyone?? And i don't want to use QT, so please don't suggest it here!

Was it helpful?

Solution

The only official way to get rid of the security popups, is to sign your midlet using a certificate from Thawte or Verisign. Such a certificate will cost you $299 a year. Of course no indie developer can afford to pay that amount, especially if his apps are mostly for himself.

Therefor people has invented unofficial ways to get rid of them.

For Sony Ericsson's feature phones, you can apply a patch on the individual phone to remove all security popups. I've done this a few times, and it's awesome! Finally I can create useful apps because nothing prevents them from running.

The downside is that it obviously won't help all your customers. If you have a bunch of customers, you can't escape the signing part.

But if you code small apps mostly for yourself, then patching can be very stress relieving. :-)

I don't know how to patch other brands of phones though. Therefor I recently asked this question here at stackoverflow.com. But my question was closed. Apparently administrators don't think it's relevant. I tried to explain why I thought it was relevant in relation to "tools used by developers", but then they removed the post.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top