Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6665845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:45:58+00:00 2026-05-26T02:45:58+00:00

I Write the following code in my application. It will run successfully in Simulator

  • 0

I Write the following code in my application.
It will run successfully in Simulator but while i m trying to run in my device then it gives Lat & Lon (0.0,0.0).
What is the problem.

My Code is .

public class GetLatLon extends TimerTask{
public static Timer timer;
private double longitude;
private double latitude;

public GetLatLon(int duration) {
    timer = new Timer();
    try {
        // TODO: update criteria with desired location distances, etc
        LocationProvider.getInstance(new Criteria()).setLocationListener(
                new MyLocationListener(), 1, 1, 1);
    } catch (Exception e) {
        System.err.println(e.toString());
    }

    timer.schedule(this, 0, 10000);
}

public void run() {
    System.out.println("Lattitude :-"+ latitude);
    System.out.println("Longitude :-"+ longitude);       
}

public double getLongitude() {
    return longitude;
}

public void setLongitude(double longitude) {
    this.longitude = longitude;
}

public double getLatitude() {
    return latitude;
}

public void setLatitude(double latitude) {
    this.latitude = latitude;
}

private class MyLocationListener implements LocationListener {
public void locationUpdated(LocationProvider provider, Location location) {
    if (location != null && location.isValid()) {
        QualifiedCoordinates qc = location.getQualifiedCoordinates()
                     try {
        GetLatLon.this.longitude = qc.getLongitude();
        GetLatLon.this.latitude = qc.getLatitude();
        } catch (Exception e) {
             System.err.println("criccomini " + e.toString());
        }
        } else {
            System.err.println("criccomini location not valid");
        }
    }

    public void providerStateChanged(LocationProvider provider, int newState) {

    }
}

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T02:45:59+00:00Added an answer on May 26, 2026 at 2:45 am

    I had also faced same problem with 9550 Storm-2.
    I think you face the problem due to your device GPS value does not initiate properly. Try to use this tool :

    http://appworld.blackberry.com/webstore/content/12255

    this will initiate the GPS values(Plz don’t close this tool just send it to background by pressing red key).After initiate the GPS value try to run you application.

    i hope problem will be solved. 😉

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having problems with wxpython. When I run the following code, it will
The following code will not run correctly in IE7 with the latest service packs
I'm trying to write a C# application that will find a document open in
Hi I'm trying to use Javascript to write a chrome application that will show
I write the following code all the time to handle when the enter key
How can I write the following code quickly in emacs? \newcommand{\cA}{\mathcal A} \newcommand{\cB}{\mathcal B}
If I write the following code: session_start(); $_SESSION['user_id']='daniel'; the variable stays fine as long
When I write the following code I get garbage for an output. It is
How would I write the following C# code in F#? namespace Shared { public
I am a AS3 novice learning PureMVC and want to write code following best

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.