java.lang.securityexception Applicatiion not authorized to access restriced

Hello,

I'm creating a midlet, when I execute the midlet in my phone I get a java.lang.securityexception Application not authorized to access the restricted api.

My phone is MIDP 2.0, CLDC 1.1 it has MMAPI 1.1, it supports audio capture.

I suspect one of these lines causes the problem

p= Manager.createPlayer("capture://audio?encoding=audio/amr")

p.realize();

rc = (RecordControl)p.getControl("RecordControl");

but i'm not sure which line since i don't have an emulator for my phone. Below is a part of the code.

Thread thrd = new Thread()

{

public void run()

{

try {

// Create a DataSource that captures live audio.

int index= listBox.getSelectedIndex();

String enc="";

if(index == 0)

{

p= Manager.createPlayer("capture://audio?encoding=audio/amr")

enc = "AMR";

}

p.realize();

rc = (RecordControl)p.getControl("RecordControl");

output = new ByteArrayOutputStream();

rc.setRecordStream(output);

rc.startRecord();

p.start();

showAlert("Recording","Using the " + enc + " encoding");

} catch (Exception ex) {

showExceptionAlert(ex,null);

ex.printStackTrace();

}

}

};

thrd.start();

[1301 byte] By [aztec31a] at [2007-10-3 4:24:39]
# 1
I figured out that the method rc.setRecordStream(output); causes the securityexception to be thrown.I believe I have to sign the midlet in order for the setRecordStream to work, how do I go about doing that?
aztec31a at 2007-7-14 22:27:06 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 2

hi

whn i m running my project in emulator i m getting sm error like

ava.lang.SecurityException: Application not authorized to access the restricted API

java.lang.SecurityException: Application not authorized to access the restricted API

at com.sun.midp.security.SecurityToken.checkForPermission(+331)

at com.sun.midp.security.SecurityToken.checkForPermission(+15)

at com.sun.midp.midletsuite.MIDletSuiteImpl.checkForPermission(+20)

at com.sun.midp.dev.DevMIDletSuiteImpl.checkForPermission(+28)

at com.sun.midp.dev.DevMIDletSuiteImpl.checkForPermission(+7)

at com.sun.midp.io.ConnectionBaseAdapter.checkForPermission(+67)

at com.sun.midp.io.j2me.http.Protocol.checkForPermission(+17)

at com.sun.midp.io.ConnectionBaseAdapter.openPrim(+6)

at javax.microedition.io.Connector.openPrim(+121)

at javax.microedition.io.Connector.open(+15)

at javax.microedition.io.Connector.open(+6)

at socketexam.run(+116)

plz tell me how can i solve my problem?

pooja_rania at 2007-7-14 22:27:06 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 3
In my case all that was needed was a signed midlet by the phone carrier. Not sure why in emulator you get that message, check to see if getting your midlet signed gets rid of the problem.
aztec30a at 2007-7-14 22:27:06 > top of Java-index,Java Mobility Forums,Java ME Technologies...