BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 05-26-2009, 04:32 AM   #1
cherukuri.sudheer
New Member
 
Join Date: Nov 2008
Model: 7100t
PIN: N/A
Carrier: vodafone
Posts: 1
Default Location API (LocationException timed out issue) on blackberry 9000

Please Login to Remove!

Hi all,

i am working on Location API on Blackberry 9000, when i run the following program i am getting the below exception

javax.microedition.location.LocationException:Time d out while waiting for GPS Location.


Does it require carrier support,i am using Airtel carrier in India. i am getting same exception when i run it on a J2ME device.

Please give me any suggestions on this issue?


package com.ea.location;

import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.component.RichTextField;

import javax.microedition.location.Location;
import javax.microedition.location.LocationProvider;
import javax.microedition.location.Criteria;
import javax.microedition.location.Coordinates;
import javax.microedition.location.LocationException;



import java.lang.System;


public class BBLocationApp extends UiApplication {
public BBLocationApp(){
UiScreen us = new UiScreen();
pushScreen(us);
}
public static void main(String str[]){
BBLocationApp app = new BBLocationApp();
app.enterEventDispatcher();
}
}
class UiScreen extends MainScreen{
UiScreen(){
setTitle("Location Finder");
String locationVersion = System.getProperty("microedition.location.version" );
RichTextField rtf = new RichTextField("Location Version : "+locationVersion);
add(rtf);
try {
// Create a Criteria object for defining desired selection criteria
Criteria cr = new Criteria();
// Specify horizontal accuracy of 500 meters, leave other parameters
// at default values.
cr.setHorizontalAccuracy(500);
LocationProvider lp = LocationProvider.getInstance(cr);
// get the location, one minute timeout
Location l=null;
try {
l = lp.getLocation(60);
} catch (InterruptedException e) {
RichTextField exception = new RichTextField("EXC 1 : "+e);
add(exception);
// TODO Auto-generated catch block
e.printStackTrace();
}
if(l != null){
Coordinates c = l.getQualifiedCoordinates();
if (c != null) {
RichTextField altitude = new RichTextField("Altitude : "+c.getAltitude());
RichTextField latitude = new RichTextField("Latitude : "+c.getLatitude());
RichTextField longitude = new RichTextField("Longitude : "+c.getLongitude());

add(altitude);
add(latitude);
add(longitude);
// use coordinate information
}
}
} catch (LocationException e) {
RichTextField exception = new RichTextField("EXC 2 : "+e);
add(exception);
// not able to retrive location information
}
}
}
Offline  
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


IBM Correctable Ribbon Cassette Black 1299300 NOS Original OEM picture

IBM Correctable Ribbon Cassette Black 1299300 NOS Original OEM

$2.99



IBM CASH DRAWER KEY'S #9960 SET OF 2 KEYS. AFTERMARKET KEY'S SAME AS OEM 33G3360 picture

IBM CASH DRAWER KEY'S #9960 SET OF 2 KEYS. AFTERMARKET KEY'S SAME AS OEM 33G3360

$18.00



IBM Staple Cartridge, 41U2175, 318349, 5,000 (OEM / New) picture

IBM Staple Cartridge, 41U2175, 318349, 5,000 (OEM / New)

$49.95



Genuine OEM IBM Wheelwriter Printwheel - Choose by Reorder Number or Type Style picture

Genuine OEM IBM Wheelwriter Printwheel - Choose by Reorder Number or Type Style

$49.95



2 New OEM Toshiba SR5000,SR5020,SR4110 Staple-2500 Cartridge 318332 1pc. picture

2 New OEM Toshiba SR5000,SR5020,SR4110 Staple-2500 Cartridge 318332 1pc.

$120.00



IBM Genuine OEM Printer Filler Wide Credit Card Holder 10N1259 picture

IBM Genuine OEM Printer Filler Wide Credit Card Holder 10N1259

$24.79







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.