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




Have Programming Question? Ask it here!
 
 
 


Pawan
Location Api
0 Answer(s)      4 years and 5 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
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
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
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
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
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
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
Theming API
Theming API       Theming API You can edit or modify theme of widget by modifying 'ui.core.css' and 'ui.theme.css' . These two
Java Mail API Tutorial
Java Mail API Tutorial  I have to write programs using the Java Mail API. I want to learn the Java Mail API. Let's know the urls to learn Java Mail API with example code. Thanks   Hi, You can easily learn the Java
JavaScript google map API example.
map, business location, route planner etc. Google Maps API- Google Maps API...JavaScript google map API example.  How to Use Google Maps API..., location and many more things. As railway maps contain all railway
java api for antivirus - Spring
java api for antivirus   hi How to scan uploaded file with antivirus like yahoo
java api - CVS
java api  hi, I want a java api to chechout a projects from cvs.Please help me divya.mamillapalli
What is criteria API?
What is criteria API?  Hi, What is criteria API? Thanks,  ... Thanks,   Hi, The API (Application Programming Interface... on the persistence database. The hibernate criteria API is very Simplified API for fetching data
Google Map get Current Location on iphone and Android phones
Google Map get Current Location on iphone and Android phones  Hi, I am writing a simple javascript to get longitude and latitude for current location by using google API , but it works in my desktop browser but it doesn't
Hibernate API
Hibernate API In this section we will learn about important Hibernate API... in Java. Hibernate provides API to perform CRUD operations on the persistence objects... of Hibernate API are: org.hibernate.cfg.Configuration - The object
Twitter REST API
Twitter REST API  While writing a program to post the tweet into twitter i am getting following error: The Twitter REST API v1 is no longer active. Please mig rate to API v1.1 What could the the solution? Thanks   Hi
API - Development process
API  I want to connect to WordNet and I consequently downloaded the API,JWNL(Java WordNet Library ) for connection.How exactly do I use this API in my Java application or rather How do I make Java see it so that I can use
JasperReports with Java API
JasperReports with Java API  I am new to jaspersoft. I dont know how to run a report in Java API and how to access a java class file with jasper reports....Please help me
How to downloads an application of the file from remote location?
How to downloads an application of the file from remote location?  Hi... location? Thanks,   Hi, As per your query i fell this example... an application of file in the remote location. Plz visit this link for how to download
uSING JAVA API
uSING JAVA API  How to extract Quickbooks online data using Quickbooks api( Rest ApI) write in java code ? 1.register company account 2..register application 3.get apptoken,consumer key,consumer screte 4.how can i
Google Ajax API
Google Ajax API  Hi, What is Google Ajax API? From where I can get in our application. Thanks   Hi, Google AJAX APIs is a JavaScript... content on web pages. More details at Google Ajax API's page. Thanks
to make a google map point to user defined location
) and points the location in google map.so how do i do it? wen i press the submit... the desired location of the user
Getting Latitude and longitude from GPS location?
Getting Latitude and longitude from GPS location?  I want to get longitude and latitude from GPS location. I want to find the distance between the two places(Example: Delhi and Mumbai). If I get Latitude and longitude
Regarding Documentation of API
. How to type in Windows command prompt(console) to get the documentation API
Regarding Documentation of API
in Windows command prompt(console) to get the documentation API.   Give
How to Using timezone_location_get() PHP
How to Using timezone_location_get() PHP  Hi, I am trying to create an application using the timezonelocationget() in PHP to retrieve the data of country code & latitude/longitude. I need the help of PHP developer who can
 

 

 

DMCA.com