Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Pawan
Location Api
0 Answer(s)      4 years and 9 months ago
Posted in : MobileApplications


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.

Advertisement
View Answers

Related Tutorials/Questions & Answers:
Location Api - MobileApplications
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... a location provider: Criteria cr= new Criteria(); public void
API
API  what means API in java?   Hi Friend, The Application Programming Interface (API) is a library of functions that allow programmers... for building software applications in java. If you want to know about java api, please
Advertisements
api
api  WHAT IS THE DEFINITON OF API,EXPLAIN IN DETAIL?   An API is the interface implemented by an application which allows other... of it by a computer program. An API differs from an application binary interface
Location Reminder
Location 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 - MobileApplications
location  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 search
mkmapkit location search  How to create a location search function that will allow the current location search on the MKMapKit
iphone location framework
iphone 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   
mkmapview zoom to current location
mkmapview zoom to current location  How can i zoom map to the current location
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
jUSB api
jUSB api  How can i access the USB using jUSB api and also hw to add this api to the netbeans
j2me location updates programming
j2me 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
Remote Location Handeling - RMI
Remote Location Handeling  I have application where I want main control from one location and have to connect two more locations remotly and have... location
Collections API
Collections API  hello, What is the Collections API?   hi The Collections API is a set of classes and interfaces that support operations on collections of objects
API for beginners
API for beginners  what is api? why api is needed in java?   Hi Friend, The Application Programming Interface (API) is a library... to know more about java api, please visit the following link: Java API Thanks
java api
java api  what is work of api in java   An application programming interface (API) is a library of functions that Java provides.... For more information,visit the following link: Java API
java API
java API  hello What is the Java API?   hello, The Java API is a large collection of ready-made software components that provide many useful capabilities, such as graphical user interface (GUI) widgets
jpcap_api
jpcap_api  **how can I implement JPCAP API with Java what are the steps needs to do with jdk1.6
timezone_location_get
timezone_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
Automatic Vehicle Location Advantage,Automatic Vehicle Location,Vehicle Location
Automatic Vehicle Location Advantage     ... Location or AVL is a system primarily used in tracking vehicles, freight... Better security for driver as well as travelers by enabling faster location
JavaScript method location
JavaScript method location         ... using location property of the window object. One of them is location.href which
Program in javascript to show the current location
Program in javascript to show the current location  Hi All, Actually in my application ..i wanted to updated the current location each time it gets... location in JavaScript? Thanks
Struts API - Struts Framework API online
the location of the api files. The easiest way is to read the Struts...Struts API - Struts Framework API online... are looking for the Struts API, you can either download the struts framework
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 
Struts properties file location - Struts
Struts 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
File location in FileOutputStream - JSP-Servlet
File 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
Location finding error - JSP-Servlet
Location 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 process
Project 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
JSP API
JSP API API stands for Java Application Programming Interface. If you are looking for the JSP API then visit http://java.sun.com/products/servlet/2.2/javadoc/index.html and read about JSP 2.2 API. Here is the description
Java API
Java API       Java API Java API is not but a set of classes and interfaces that comes with the JDK. Java API is actually a huge collection of library
java API for adobe
java API for adobe  where I can find adobe api for ReaderExtensionsServiceClient class ? plz help
 

 

 

DMCA.com