Hello Nomaan Butt,
Actually i have written the code for it please can you have a look on it and tell me what the problems or errors i may face. i will show only the imp part of the project.there are four classes GPS, Main , locatioonlistenerexample and GPRS. At present my project is like i need to retrieve the GPS location and send that values through GPRS to some URL. Now only we using gprs to send the GPS location but later many other applications come into picture which uses the gprs to send data. at present i am working on GPS using GPRS so in future this following code should not lead to an error so suggest if there any errors that may occur in future when many applications uses GPRS
class Main{
public static void main(
String[] args){
Gps ref = new Gps();
ref.locationprovider(); }
}
class Gps{
locationprovider(){
here it assigns the location provider and then calls the location listener method.
}
listener()
{
here it assigns the listener and then schedules the listener for few secs lets take 60 secs }
}
public class LocationListenerExample implements LocationListener{
public double latitude, longitude;
Gprs runnable = new Gprs();
/after every 60secs this locationupdate is automatically called and updated the location value. its as per the GPS API
public void location Updated(LocationProvider locationprovider,
Location location){
.......
......
......
if (latitude!=0 && longitude!=0) {
synchronized(runnable) {
runnable.latitude = latitude;
runnable.longitude = longitude;
Thread ref = new Thread(runnable);
ref.start();
}}}
}
class Gprs{
double lat, long;
public synchronized void run(){
here it sends that lat and long value to URL
}
}