Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Registered User orsteglasy's Avatar
    Join Date
    Feb 2007
    Posts
    18
    Hi,

    I'm creating a navigation midlet. It gets positions thru bluetooth and an external GPS receiver. Now i want to implement JSR-179 Location API to use the built in GPS unit of some new phones. This means if the phone supports JSR-179 then the build in GPS should be used, if not BT discovery will start.

    Is it possible to do this in one single midlet? I've made some quick tests and my midlet didn't start at all on non JSR-179 phones, saying "No Class Def Found Error" and references some JSR-179 classes. Is it possible to check at runtime if the API is supported and avoid this error somehow? Or do I have to create two different midlets for the two different type of phones?

    Thanks a lot!
    Ors

  2. #2
    Nokia Developer Champion Tiger79's Avatar
    Join Date
    Apr 2007
    Posts
    2,697
    if (System.getProperty("microedition.location.version") == null)
    {
    /* Location Package is NOT installed */
    return false;
    }
    else
    {
    /* Location Package is installed */
    return true;
    }

    Try that

  3. #3
    Nokia Developer Champion njzk2's Avatar
    Join Date
    Mar 2005
    Location
    Paris
    Posts
    814
    you need separated classes that won't be loaded if the jsr179 is not present.
    it means that there is a test like tiger wrote, and everything that refers to the 179 must be conditionned by this, even imports.

  4. #4
    Nokia Developer Expert dcrocha's Avatar
    Join Date
    Jun 2005
    Posts
    923
    Both of you are right.

    1) Do not import JSR 179 classes on the main midlet.
    2) Test whether JSR 179 is implemented on the midlet constructor.
    3) Make sure any classes using JSR 179 on non-enabled phones do not get loaded (a.k.a. do not create instances of them)

    and you should be fine.

    Daniel
    Last edited by dcrocha; 2007-11-07 at 16:47. Reason: mispelling

  5. #5
    Registered User orsteglasy's Avatar
    Join Date
    Feb 2007
    Posts
    18
    Hi All,

    Thanks for your suggestions, I understand the recommended approach, however not sure about the implementation:

    1. In other classes then the main midlet, can i import those classes? If NOT: how can i avoid this? The code below seems to be illegal:

    ...
    import java.util.TimerTask;
    import Real.*;

    if (System.getProperty("microedition.location.version") != null)
    {
    import javax.microedition.location.Location;
    import javax.microedition.location.LocationException;
    }

    2. In other classes then the main midlet, can a create objects of that class? If NOT: how can i avoid it? The code below is illegal:

    public class GPSReader extends TimerTask
    {
    int counter = 0;
    if (System.getProperty("microedition.location.version") != null)
    {
    Location loc;
    }

    Thanks a lot!
    Örs

  6. #6
    Nokia Developer Champion traud's Avatar
    Join Date
    Mar 2003
    Posts
    3,934

  7. #7
    Registered User orsteglasy's Avatar
    Join Date
    Feb 2007
    Posts
    18
    Wooow, what a nice solution!
    Thanks Traud!
    Örs

  8. #8
    Registered User conbo's Avatar
    Join Date
    Dec 2008
    Posts
    7
    I want to know the "nice solution", 'cause I have the same problem. In the link traud introduce, it's only the JSR 248.

  9. #9
    Registered User grahamhughes's Avatar
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,394
    How to use an optional API in Java ME.

    I hope this helps.

    Cheers,
    Graham.

  10. #10
    i am using nokia c2-00. according to given manual , it supports jsr-179. but when i try to load a location package class in my program, it is throwing an exception....cant load Location class...
    why is it showing this error?

  11. #11
    In nokia c2-00, can i use javax.microedition.location package to develop an app ?

  12. #12
    Nokia Developer Champion im2amit's Avatar
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    2,916
    Quote Originally Posted by ramakrishnanokia View Post
    In nokia c2-00, can i use javax.microedition.location package to develop an app ?
    Nokia C2-00 do not support JSR 179 -- its Series 40 5th Ed. FP1 Lite SDK based deice --- Please check the specs at https://www.developer.nokia.com/Devi...cations/C2-00/
    thanks,
    ~Amitabh
    (Poster of the Month -Dec'12)
    Follow me on my blog for Innovative Mobile Apps

  13. #13
    Thank u....

    Nokia 110 is also Series 40 5th Ed. FP1 Lite SDK... At the same time it has Nokia SDK 1.1 for Java also..
    Is it going to useful to use Location Api?

  14. #14
    Nokia Developer Champion im2amit's Avatar
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    2,916
    Yes, Nokia 110 supports JSR 179 and you can use it.
    You check which location providers are present on the device and use it.
    If the device does not have in-built GPS chip, JSR 179 will try to search for Bluetooth based GPS receiver from which it can fetch the location co-ordinates.
    thanks,
    ~Amitabh
    (Poster of the Month -Dec'12)
    Follow me on my blog for Innovative Mobile Apps

  15. #15
    Thank u...
    Is it possible to get jar for com.nokia.mid.location package?

    API bridge is applicable for Nokia Series 60 ... is there any other technique available in series 40 to get device location information ?

Page 1 of 2 12 LastLast

Similar Threads

  1. Using the Location Acquisition API in Series 60 3rd edition
    By gpalvia in forum Symbian Networking & Messaging (Closed)
    Replies: 7
    Last Post: 2007-08-29, 06:56
  2. Location API panics
    By Kimple in forum Symbian C++
    Replies: 1
    Last Post: 2005-12-21, 14:21
  3. did Nokia series was supports the Location API
    By lakshmanraob in forum Mobile Java General
    Replies: 5
    Last Post: 2005-11-16, 04:37
  4. Location API
    By cjmarsha in forum Mobile Java General
    Replies: 0
    Last Post: 2005-08-08, 20:16
  5. JSR 179 location API for Linux ?
    By carln672 in forum Mobile Java General
    Replies: 2
    Last Post: 2004-07-30, 10:21

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved