In the Nokia Asha software platform 1.0, the MIDlet developer should create a new thread to call the sensitive APIs, otherwise the Java permission dialog will block the event queue thread.
Therefore, for example, the method call in handling sendCommand should be as follows:
public void commandAction(Command command, Displayable d) { if (command == sendCommand) { new Thread() { public void run() { wmaEngine.send(numberTextField.getString(), messageTextField.getString()); } }.start(); else if (command == exitCommand) { midlet.notifyDestroyed(); } } }
The problem occurs, when the API call is in commandAction() method, not when it is, for example, in the MIDlet constructor.
public void startApp() { form = new Form("Security prompt test"); .... httpConnector = new HTTPConnector(this); httpConnector.openHTTPConnection(); // No problems } public void commandAction(Command c, Displayable d) { if (c == exitCommand) this.notifyDestroyed(); if (c == testCommand) { httpConnector = new HTTPConnector(this); httpConnector.openHTTPConnection(); // Problem exists here } }
javax.microedition.io.Connector.http javax.microedition.io.Connector.https javax.microedition.io.Connector.obex.client.tcp javax.microedition.io.Connector.obex.server.tcp javax.microedition.io.Connector.datagram javax.microedition.io.Connector.datagramreceiver javax.microedition.io.Connector.socket javax.microedition.io.Connector.serversocket javax.microedition.io.Connector.ssl javax.wireless.messaging.sms.send javax.wireless.messaging.mms.send javax.microedition.io.Connector.sms javax.wireless.messaging.sms.receive javax.microedition.io.Connector.mms javax.wireless.messaging.mms.receive javax.wireless.messaging.cbs.receive javax.microedition.io.Connector.cbs javax.microedition.io.PushRegistry javax.microedition.content.ContentHandler javax.microedition.io.Connector.comm javax.microedition.io.Connector.obex.client javax.microedition.io.Connector.obex.server javax.microedition.io.Connector.bluetooth.client javax.microedition.io.Connector.bluetooth.server javax.microedition.apdu.aid javax.microedition.jcrmi javax.microedition.securityservice.CMSMessageSignatureService javax.microedition.media.control.RecordControl javax.microedition.media.control.VideoControl.getSnapshot javax.microedition.amms.control.camera.enableShutterFeedback javax.microedition.pim.ContactList.read javax.microedition.pim.EventList.read javax.microedition.pim.ToDoList.read javax.microedition.io.Connector.file.read javax.microedition.pim.ContactList.write javax.microedition.pim.EventList.write javax.microedition.pim.ToDoList.write javax.microedition.io.Connector.file.write javax.microedition.amms.control.tuner.setPreset javax.microedition.location.Location javax.microedition.location.ProximityListener javax.microedition.location.Orientation javax.microedition.location.LandmarkStore.read javax.microedition.location.LandmarkStore.write javax.microedition.location.LandmarkStore.category javax.microedition.location.LandmarkStore.management javax.microedition.apdu.sat javax.microedition.io.Connector.sensor javax.microedition.sensor.PrivateSensor javax.microedition.sensor.ProtectedSensor