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

  • SEARCH
  • Home
  • 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 799669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T23:10:00+00:00 2026-05-14T23:10:00+00:00

in my application i try to fetch users location but it always 0.0 for

  • 0

in my application i try to fetch users location but it always 0.0 for both latitude and longitude.I have seen blackberry forum but couldn’t find what am i doing wrong???

code :

  package com.MyChamberApp;

    import javax.microedition.location.Criteria;
    import javax.microedition.location.Location;
    import javax.microedition.location.LocationListener;
    import javax.microedition.location.LocationProvider;

    public class GPS_Location {
     static double longi;
     static double lati;

     public GPS_Location() {

     }

     public void location()
     {
      new LocationTracker();
     }

     class LocationTracker 
     {
      private LocationProvider provider;
      Criteria cr;

      public LocationTracker() 
      {
       resetGPS();
      }

      public void resetGPS() {

      try {
      cr = new Criteria();
      cr.setPreferredPowerConsumption(Criteria.POWER_USAGE_HIGH);
      cr.setPreferredResponseTime(120000);
                cr.setCostAllowed(true);
      provider = LocationProvider.getInstance(cr);
      provider.getLocation(120);
      if (provider != null) 
       {
        provider.setLocationListener(new MyLocationListener(), 1,1,1);
       }
      } catch (Exception e) {}

      }

      public void run(){}

     private class MyLocationListener implements LocationListener 
         {
       public void providerStateChanged(LocationProvider provider,int newState)
       {
        if (newState == LocationProvider.TEMPORARILY_UNAVAILABLE)
        {
          provider.reset();
          resetGPS();
        }
       if (newState == LocationProvider.OUT_OF_SERVICE)
       {
        provider.reset();
        resetGPS();
       }
     }

     public void locationUpdated(LocationProvider provider,Location location) 
      {
       if (location != null && location.isValid()) {
        try {
      lati = location.getQualifiedCoordinates().getLatitude();
      longi = location.getQualifiedCoordinates().getLongitude();
         } catch (Exception e) {}
     }
      }
    }
   }
 }

i have tried this code on curve8300,bold9000
It works well on simulator but does not fetches value on device even if i manually refresh my gps from options–>advanced options–>gps.
thanks in advance!!!!!!!!!!!!!!!!

  • 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-14T23:10:01+00:00Added an answer on May 14, 2026 at 11:10 pm
    criteria.setHorizontalAccuracy(500);
    criteria.setVerticalAccuracy(500);
    

    set horizontal and vertical accuracy to low values.this will help to some extent in terms of accuracy

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

Sidebar

Related Questions

I am trying to fetch Gps latitude and longitude, but i am having a
Im working on a small application to try out an idea that I have.
I try to add an addons system to my Windows.Net application using Reflection; but
I try to fetch user's feeds via graph api from my Android application. It
i have developed an application in which i fetch books using googleapibook search. I
In my application users enter a url and I try to open the link
hi friend i try to give weather application by fetch by xml parser and
I am working in one application in which I have to fetch all the
I have some expierence in PHP, but have no one in application architecture Now
I frequently start with a simple console application to try out an idea, then

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.