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


Vintage Post-it Note Pad Apple Magnetic Holder Pince A Notes Unused 1988 NOS picture

Vintage Post-it Note Pad Apple Magnetic Holder Pince A Notes Unused 1988 NOS

$16.99



Vintage 1993 Mini Apple Post-It Sticky Notes, 3

Vintage 1993 Mini Apple Post-It Sticky Notes, 3" x 2" Teacher

$4.95



Vintage Letterpress Apple Printing Block Metal Wood Small 1 inch picture

Vintage Letterpress Apple Printing Block Metal Wood Small 1 inch

$7.99



Vintage Red Resin Apple Silver Clip Memo Note Business Jason's Deli Card Holder picture

Vintage Red Resin Apple Silver Clip Memo Note Business Jason's Deli Card Holder

$17.99



VINTAGE COLLECTIBLE / IBM / APPLE / POWERPC / MICROPROCESSOR CHIP / 90X8941 (JO) picture

VINTAGE COLLECTIBLE / IBM / APPLE / POWERPC / MICROPROCESSOR CHIP / 90X8941 (JO)

$9.99



VINTAGE 1994 Apple Black Toner Laser Writer Cartridge M 2473 G/A NEW SEALED picture

VINTAGE 1994 Apple Black Toner Laser Writer Cartridge M 2473 G/A NEW SEALED

$25.95







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