×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Nov 2006
    Posts
    12

    questions about location

    Dear all:

    I am developing a program and want to locate my cell phone.

    part of my program is:

    import javax.microedition.location.*;
    import javax.microedition.lcdui.Alert;
    import javax.microedition.lcdui.AlertType;
    import javax.microedition.lcdui.Displayable;
    import javax.microedition.lcdui.Form;


    public class Location{
    public int Cell_ID;
    public double x;
    public double y;
    public Criteria crit;
    public LocationProvider provider;
    public Location location;
    public Where where;

    private Form searchForm = new Form("Seaching location provider...");
    public Location(){
    if(isLocationApiSupported()){
    try
    {
    crit = new Criteria();
    crit.setHorizontalAccuracy(500); // 500m
    crit.setVerticalAccuracy(Criteria.NO_REQUIREMENT);
    crit.setPreferredResponseTime(Criteria.NO_REQUIREMENT);
    crit.setPreferredPowerConsumption(Criteria.NO_REQUIREMENT);
    crit.setCostAllowed(true);
    crit.setSpeedAndCourseRequired(true);
    crit.setAltitudeRequired(true);
    crit.setAddressInfoRequired(false);

    provider = LocationProvider.getInstance(crit);
    location = provider.getLocation(30);
    Cell_ID = location.MTE_CELLID;
    QualifiedCoordinates coords = location.getQualifiedCoordinates();

    x = coords.getLatitude();
    y = coords.getLongitude();
    }
    catch (LocationException le)
    {
    Alert alert = new Alert("Error", "OUT_OF_SERVICE_MESSAGE", null,
    AlertType.ERROR);
    alert.setTimeout(Alert.FOREVER);
    where.display.setCurrent(alert, searchForm);
    searchForm.append("Try again after location-providing module is properly connected.");
    }

    }
    else{
    Alert alert = new Alert("Error", "Do not Support", null,
    AlertType.ERROR);
    alert.setTimeout(Alert.FOREVER);
    where.display.setCurrent(alert, searchForm);
    searchForm.append("your cell phone don't support location API");
    }


    }

    public int GetCell_ID(){

    return Cell_ID;
    }
    public static boolean isLocationApiSupported()
    {
    String version = System.getProperty("microedition.location.version");
    return (version != null && !version.equals("")) ? true : false;
    }
    }


    and there is a error in the "location = provider.getLocation(30);" and the hint is " incompatible types"I don't know why...
    and it seems that in the Location Class there is not a method to get the cell_id, is it the MTE_CELLID is the cell_id?

    thanks very much.

  2. #2
    Nokia Developer Champion
    Join Date
    Jun 2005
    Location
    Beijing
    Posts
    5,578

    Re: questions about location

    I think you'd better post it in JAVA board.
    Beover1984
    -----------
    Doing what comes naturally

  3. #3
    Registered User
    Join Date
    Nov 2006
    Posts
    12

    Re: questions about location

    刚才有稍微看了一下class Location 看到MTE_CELLID 是一个常数。

    getLocationMethod()可以得到 定位的方式是否为 cellular。

    但没有看到可以取得cell_ID 的函数。是否有其他办法可以取得 CELL_ID 在论坛里看到有人用C++编写的程序可以取得CELL_ID,那么j2ME应该也可以吧。。

  4. #4
    Regular Contributor
    Join Date
    Dec 2005
    Posts
    442

    Re: questions about location

    location = provider.getLocation(30);

    You should check if the LocationProvider's getLocation(int) will return the type Location.

    BTW, as beover said, maybe you should post it into java board
    Symbian game and application developer.
    Fat
    Good Luck

  5. #5
    Registered User
    Join Date
    Nov 2006
    Posts
    12

    Re: questions about location

    thanks beover1984 and amfat...

    I have post it in java board. But I don't get the answer.

    getLocation(int) return a Location Object.

Similar Threads

  1. Location Security Permisions in Emulator
    By MarkPearce in forum Mobile Java Networking & Messaging & Security
    Replies: 6
    Last Post: 2011-09-20, 08:32
  2. Location Log Application
    By znakharenko in forum Symbian
    Replies: 9
    Last Post: 2006-02-06, 20:01
  3. Location API of Series 60 2nd Edition FP2
    By razas in forum Symbian
    Replies: 0
    Last Post: 2006-01-05, 07:13
  4. did Nokia series was supports the Location API
    By lakshmanraob in forum Mobile Java General
    Replies: 5
    Last Post: 2005-11-16, 04:37
  5. problem with location API in 6630
    By lakshmanraob in forum General Development Questions
    Replies: 0
    Last Post: 2005-09-21, 15:02

Posting Permissions

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