Location Api
I am using following code to get coordinates of location in gps.
On emulator in netbeans it shows me output as
2.0 2.0
but on real mobile it doesrnt give me any help:
package com.tutorial;
import javax.microedition.location.*;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
//import net.jscience.util.MathFP;
public class HelloMap
extends MIDlet
implements CommandListener {
private Form mMainForm;
public HelloMap() {
mMainForm = new Form("Hello map");
mMainForm.append(new StringItem(null, "Hello, map!\n"));
mMainForm.addCommand(new Command("Exit", Command.EXIT, 0));
mMainForm.setCommandListener(this);
}
// First Set criteria for selecting a location provider:
Criteria cr= new Criteria();
public void startApp() {
cr.setHorizontalAccuracy(500); // accurate to 500 meters horizontally
try {
// Now get an instance of the provider
LocationProvider lp= LocationProvider.getInstance(cr);
// Request the location, setting a one-minute timeout
Location l = lp.getLocation(2);
Coordinates c = l.getQualifiedCoordinates();
if(c != null ) {
// Get coordinate information
double lat = c.getLatitude();
double lon = c.getLongitude();
mMainForm.append(""+lat+""+lon);
}
} catch (Exception e) {
}
Display.getDisplay(this).setCurrent(mMainForm);
}
public void pauseApp() {}
public void destroyApp(boolean unconditional) {}
public void commandAction(Command c, Displayable s) {
notifyDestroyed();
}
}
Please help.
View Answers
Related Tutorials/Questions & Answers:
Location Api - MobileApplicationsLocation Api I am using following code to get coordinates of
location in gps.
On emulator in netbeans it shows me output as
2.0 2.0... a
location provider:
Criteria cr= new Criteria();
public void
Advertisements
Location ReminderLocation Reminder Hi, i am planing to do a project called
location... mark thar place in my mobile, and later if i visit that
location,my mobile has to give a reminder.
How to mark a
location on mobile using GPS?
Please give me
cursor location cursor
location hi,please how to change cursor
location by java code ,i use this code but not change the
location
JTextArea a=new JtextArea();
if(resultText.equalsIgnoreCase("class")){
a.append("a { \n }");
PointerInfo
location - MobileApplicationslocation I want to do project in which when i go to college
my mobile should get automatically to silent mode using the
location where the
college...
location that come on our mobile display and silent the mobile.
im new to J2ME
mkmapkit location searchmkmapkit
location search How to create a
location search function that will allow the current
location search on the MKMapKit
ModuleNotFoundError: No module named 'location'ModuleNotFoundError: No module named '
location' Hi,
My Python... '
location'
How to remove the ModuleNotFoundError: No module named '
location... to install padas library.
You can install
location python with following
iphone location frameworkiphone
location framework Which framework do i need to add to get the iphone current
location in iPhone frameworks?
Add core
location to your existing frameworks.
CoreLocation.framework
j2me location updates programmingj2me
location updates programming kindly please, assist me with with a j2me code for obtaining and sending GPS
location updates periodicaly to the server IE; LATITUDE, LONGITUDE, SPEED, TIME. Am using netbeans IDE and PHP
neo4j-server.properties file locationneo4j-server.properties file location Hi,
Where is the
location of neo4j-server.properties file in Linux?
Thanks
Hi,
Location of neo4j-server.properties file:
This file is present in /etc/neo4j directory of linux
Remote Location Handeling - RMIRemote
Location Handeling I have application where I want main control from one
location and have to connect two more locations remotly and have...
location location of htdocs in ubuntulocation of htdocs in ubuntu Hi,
I am working on Apache server... is the
location of htdocs in apache on Ubuntu server?
Thanks
Hi,
The default
location of htdocs in Ubuntu is: /var/www
But it all depends
Find Exact Location from IP address in java?Find Exact
Location from IP address in java? I am looking for
API where we can pass IP address and get the
location (Cityname,Country name).
please suggest any
API OR sample code.
Thank you
timezone_location_gettimezone_
location_get() Function in PHP
timezone_
location_get alias DateTimeZone::getLocation returns
location information for a timezone including country code, latitude/longitude and comments.
Syntax of timezone_
location_get
JavaScript method location
JavaScript method
location
... using
location property of the window object. One of
them is location.href which
what is hibernate dtd file locationwhat is hibernate dtd file location Hi,
I am trying to find dtd of Hibernate online but not able to find.
what is hibernate dtd file
location
Thanks
Java Get Class Location Java Get Class
Location
...
location. For this, we
have used the classes URL and ClassLoader. The class...(classLocation)
returns the
location of the class.
import
File location in FileOutputStream - JSP-ServletFile
location in FileOutputStream Hai,
For uploading a file i... a method to specify a
location to store the file which is uploaded. I required...\webapps\mca2006sfssjc.co.in\stud\images
by changing the
location to the folder
Struts properties file location - StrutsStruts properties file location Hi,
Where struts properties file stored in web application. I mean which
location. Thank u Hi Friend,
The struts.properties file can be locate anywhere on the classpath
Location finding error - JSP-ServletLocation finding error
Location needs from drive name:
My file uploading program has an error. It requires the
location should be given from the directory name. Instead of this if only parent directory is given it shows
Project Location change - Development processProject
Location change Hi , I have developed mini project . In my machine everything is working fine. But i moved that folder to another machine ,ow can i run that project. Now i installed weblogic in tat system also