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


Thread Tools

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


Allen-Bradley 1772-MEB Memory Module picture

Allen-Bradley 1772-MEB Memory Module

$266.18



Coltene HyFlex CM Controlled Memory Niti file starter pack picture

Coltene HyFlex CM Controlled Memory Niti file starter pack

$48.99



New Sealed AB 2080-MEMBAK-RTC Memory Backup, Data Log, Recipe ,High Accuracy RTC picture

New Sealed AB 2080-MEMBAK-RTC Memory Backup, Data Log, Recipe ,High Accuracy RTC

$284.01



New Sealed AB 2080-MEMBAK-RTC Memory Backup, Data Log, Recipe ,High Accuracy RTC picture

New Sealed AB 2080-MEMBAK-RTC Memory Backup, Data Log, Recipe ,High Accuracy RTC

$289.16



New Sealed AB 2080-MEMBAK-RTC Memory Backup, Data Log, Recipe ,High Accuracy RTC picture

New Sealed AB 2080-MEMBAK-RTC Memory Backup, Data Log, Recipe ,High Accuracy RTC

$280.92



NEW Original Allen Bradley 2080-MEMBAK-RTC Memory Module With RTC Plug-In picture

NEW Original Allen Bradley 2080-MEMBAK-RTC Memory Module With RTC Plug-In

$291.75







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