I developed an application in J2ME in which I need to make a connection to a file, but when I run this application, it gives an exception:
Application not authorized to access the restricted API
I signed the assembly using the signature server and it works fine on another device besides this device. Below is my code for the same.
Below is my code to connect to the file. First it creates a file path
String dir = "file://" + Util.get_root_dirFrom() + "m/demo.res";
Log.p("Inside the loadString method......dir");
FileConnection fc = null;
InputStream fis = null;
try {
fc = (FileConnection) Connector.open(dir, Connector.READ);
fis = fc.openInputStream();
}catch(Exception ex){
Log.p("Exception...."+ex.getMessage());
}
Util.get_root_dirFrom() methods return the directory for the memory card in this device.
How to solve this problem?
Megha source
share