×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jan 2010
    Posts
    1

    Question Howto change criteria during software esecution?

    Hi guys, i have a problem...i write a j2me application with jsr179 library and all works fine. But i have a problem...i would this:

    my application start with ( for example ) this criteria: criteria.setHorizontalAccuracy(30);
    if after 5 minuts i don't get valid gps coordinates i want to try with criteria.setHorizontalAccuracy(500);

    how is possible to implement this?
    Code:
    Criteria cr = new Criteria();
    cr.setHorizontalAccuracy(30);
    cr.setCostAllowed(true);
    LocationProvider lp = LocationProvider.getInstance(cr);
    if(!lp.getLocation(480).isValid()){
       cr = new Criteria();
       cr.setHorizontalAccuracy(1500);
       cr.setCostAllowed(true);
       cr.setPreferredPowerConsumption(Criteria.POWER_USAGE_LOW);
       lp = LocationProvider.getInstance(cr);
    is this correct?

    thank you for help and sorry for my bad english.

    Fabio

  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: Howto change criteria during software esecution?

    Tiger69 might be the better guy to answer this... but I suspect the phone largely ignores the criteria, other than to filter out values that don't match. You're probably just preventing your app from getting information. Leave the criteria as default, and filter them yourself if you really want to. The phone probably doesn't have different ways of getting location for different power requirements, or different accuracies. If it has GPS, it will use it.

    Otherwise, I guess what you're doing is right... create a new Criteria object, then a new LocationProvider.

    Popular wisdom from the location-gurus (like Tiger) seems to be that you should avoid getLocation(), and use the LocationListener mechanism instead.

    Graham.

Similar Threads

  1. Software Engineer - UK & Munich Opportunites
    By evoke in forum News and Announcements
    Replies: 0
    Last Post: 2006-10-19, 09:17
  2. Replies: 0
    Last Post: 2006-07-26, 03:49
  3. Software Engineer (C++/Symbian, London)
    By mobile2004 in forum Symbian
    Replies: 0
    Last Post: 2004-11-05, 09:41
  4. Change to English Version of Software
    By ckn_fsh in forum Symbian
    Replies: 1
    Last Post: 2004-09-02, 14:01
  5. Senior Software Engineer NEEDED !!!!!
    By searcheric in forum Symbian
    Replies: 4
    Last Post: 2004-01-28, 19: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
  •  
×