I have test midlet which requests my location via JSR-179 Location API.
I use Nokia 6275i.
Its java: MIDP-2.0, GPS enabled (I see blue icon on top of my mobile device)

When I run this app I got the following error:
"java.lang.securityexception: Positioning Log denied Location access."

Google do not give clean results.
Please, anybody know what does mean this exception?

I tried add permissions javax.microedition.location.... No success.

My test midlet is here:

package hello;

import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
import javax.microedition.location.*;

public class CoordinateAlert extends MIDlet implements CommandListener {

    private Display display;
    private Form mainForm;
    private Alert positionAlert;

    public CoordinateAlert() {
        mainForm = new Form("HelloMIDlet");
        mainForm.append(new StringItem(null, "You will be alerted of your current position."));
        mainForm.addCommand(new Command("Exit", Command.EXIT, 0));
        mainForm.addCommand(new Command("OK", Command.OK, 1));

    public void startApp() {
        display = Display.getDisplay(this);

    public void pauseApp() {}

    public void destroyApp(boolean unconditional) {}

    public void commandAction(Command c, Displayable s) {
        String label = c.getLabel();
        if (label.equals("Exit")) {
        else if (label.equals("OK")) {
            mainForm.set(0, new StringItem(null, "Tracking location ..."));
            givePositionAlert ();
            mainForm.set(0, new StringItem(null, "Again get alerted of your current position?"));

    private void givePositionAlert () {
        try {
            Criteria cr = new Criteria();
            LocationProvider lp = LocationProvider.getInstance(cr);
            Location l = lp.getLocation(60);//60 seconds, timeout
            Coordinates c = l.getQualifiedCoordinates();
            if (c != null) {
                String lat = c.convert(c.getLatitude(),c.DD_MM);
                if (c.getLatitude() > 0) {
                    lat = "E " + lat;
                else {
                    lat = "W " + lat;
                String lon = c.convert(c.getLongitude(),c.DD_MM);
                if (c.getLatitude() > 0) {
                    lon = "N " + lon;
                else {
                    lon = "S " + lon;
                positionAlert = new Alert("Location Alert");
                positionAlert.setString("\nYour present location is \n" + lat + "\n" + lon);
            else {
                positionAlert = new Alert("Location Error");
                positionAlert.setString("Null Coordinate Received");
        catch (Exception e) { //LocationException OR InterruptedException
            positionAlert = new Alert("Location Error");
            positionAlert.setString("Exception Encountered " + e);

I obtain source code from this location: http://www.easywms.com/easywms/?q=en/node/3598

Thank you in advance.

I've found my problem.
On phone "Location sharing settings" value was Emergency. I changed it to "On". After that midlet gave me coordinates.

commented: Thank you for sharing solution +16
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.