×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    3

    JSR 179 working on N95?

    hmmm - I am trying a trivial location app, and wondering if JSR 179 really works on N95; the 'GPS' app does indeed see satellites, but the attached Midlet always times out...It does, however, consistently ask me on start-up if I want to allow it access to the positioning hardware, which I do. I just loaded this as an untrusted Midlet using the microSD card.

    thanks in advance for any helpful hints!
    Chris

    ----------------------------------------------

    import java.io.*;
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    import java.util.Enumeration;
    import java.util.Hashtable;
    import javax.microedition.location.*;

    public class Location extends MIDlet {

    String error = "";
    private static Display display = null;

    protected void startApp() throws MIDletStateChangeException {
    display = Display.getDisplay(this);
    System.out.println("loading");

    LocationProvider lp=null;
    javax.microedition.location.Location location=null;

    try {
    lp= LocationProvider.getInstance(null);
    } catch(LocationException e) {
    addError(e);
    }
    String res="[RESULTS]\n";
    try {
    //timeout after a minute
    location = lp.getLocation(60);

    Coordinates coordinates = location.getQualifiedCoordinates();

    res+="Altitude:"+coordinates.getAltitude()+"\n";
    res+="Latitude:"+coordinates.getLatitude()+"\n";
    res+="Longitude:"+coordinates.getLongitude()+"\n";

    } catch(Exception e){
    addError(e);
    }

    Form f = new Form("Results");
    f.append(res);
    f.append(error);
    display.setCurrent(f);
    }

    void addError(Exception e){
    e.printStackTrace();
    error+=e.getMessage()+"\n";
    }

    protected void pauseApp() { }

    protected void destroyApp(boolean unconditional)
    throws MIDletStateChangeException { }


    public static Display getDisplay() {
    return display;
    }
    }

  2. #2
    Registered User
    Join Date
    Jan 2009
    Posts
    3

    Re: JSR 179 working on N95?

    hmmm - even with super-lenient criteria, still times out...I added this before I get the location Provider:


    Criteria crit2 = new Criteria();
    crit2.setHorizontalAccuracy(Criteria.NO_REQUIREMENT);
    crit2.setVerticalAccuracy(Criteria.NO_REQUIREMENT);
    crit2.setPreferredResponseTime(Criteria.NO_REQUIREMENT);
    crit2.setPreferredPowerConsumption(Criteria.POWER_USAGE_HIGH);
    crit2.setCostAllowed(false);
    crit2.setSpeedAndCourseRequired(false);
    crit2.setAltitudeRequired(false);
    lp= LocationProvider.getInstance(crit2);

  3. #3
    Regular Contributor
    Join Date
    Jul 2008
    Posts
    53

    Re: JSR 179 working on N95?

    I guess you are not getting GPS signals while you are testing.
    The best way to test GPS is; turn on your GPS application and wait till you get latitude and longitude. Then run your midlet. It will get poition in seconds. :P

  4. #4
    Nokia Developer Champion
    Join Date
    Apr 2007
    Posts
    2,708

    Re: JSR 179 working on N95?

    yes, JSR179 does work on N95, N95-8GB and N96... tested them all on several devices...

Similar Threads

  1. Nokia N95 Problem with JSR 234 (Very urgent)
    By garg_25 in forum Mobile Java General
    Replies: 5
    Last Post: 2008-11-03, 08:59
  2. SIP working in N95 but not in E65
    By shamime65 in forum VoIP
    Replies: 3
    Last Post: 2008-03-13, 14:39
  3. No rule to male target
    By arayappan_it in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 4
    Last Post: 2008-02-28, 10:49
  4. Authentication error installing JSR 179 test app on N70
    By yeeking in forum Mobile Java General
    Replies: 2
    Last Post: 2006-11-29, 20:02
  5. JSR 179 Vs QJAE
    By MananW in forum Mobile Java General
    Replies: 2
    Last Post: 2006-07-31, 18:54

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •