shahjagat
asked on
Android GPS Location Without Internet
I want to develop an Application which will store the Longitude and Latitude of
an Android device into device internal database, Using Device's GPS Chip and Not using Internet at all.
Can some one provide me the source code for the same.
an Android device into device internal database, Using Device's GPS Chip and Not using Internet at all.
Can some one provide me the source code for the same.
In the tutorial on gps replace the line
provider = locationManager.getBestPro vider(crit eria, false);
with
provider = LocationManager.GPS_PROVID ER;
This will force the activity to use gps rather than network. In my experience android always defaults to 'network' even when there is no network connectivity.
provider = locationManager.getBestPro
with
provider = LocationManager.GPS_PROVID
This will force the activity to use gps rather than network. In my experience android always defaults to 'network' even when there is no network connectivity.
ASKER
Thanks Argenti,
But...
I am new android developer
I am using below code, but it does not return latitude and longitude when internet is OFF,
I also want to calculate speed, distance covered and odometer reading ,
My device will be inside the bus and in the region where there is no internet.
Any help will be appreciated,
My code
MIN_TIME_BW_UPDATES=1 minute;
MIN_DISTANCE_CHANGE_FOR_UP DATES = 10; // 10 meters
locationManager.requestLoc ationUpdat es(Locatio nManager.G PS_PROVIDE R,MIN_TIME _BW_UPDATE S,MIN_DIST ANCE_CHANG E_FOR_UPDA TES, this);
if (locationManager != null)
{
location = locationManager.getLastKno wnLocation (LocationM anager.GPS _PROVIDER) ;
if (location != null) {
latitude = location.getLatitude();
longitude = location.getLongitude();
}
}
But...
I am new android developer
I am using below code, but it does not return latitude and longitude when internet is OFF,
I also want to calculate speed, distance covered and odometer reading ,
My device will be inside the bus and in the region where there is no internet.
Any help will be appreciated,
My code
MIN_TIME_BW_UPDATES=1 minute;
MIN_DISTANCE_CHANGE_FOR_UP
locationManager.requestLoc
if (locationManager != null)
{
location = locationManager.getLastKno
if (location != null) {
latitude = location.getLatitude();
longitude = location.getLongitude();
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for all answers
While I won't provide you with a fully functional example application, I can show you some useful links that you could use in order to achieve your goal:
- Here is how to create a database for your android application
- Here is how to get your GPS coordinates
Now you should be able to do your application just by combining those two pieces of information (creating your own DB application + getting your GPS coordinates + saving your coordinates into your database). As you can see, it doesn't implies using internet connection at all.
Good luck!