I am a beginner in android programming. My Graduate project is about tracking a mobile device and i need the code to save the location( Without using GPS) as a text file. So
only way to do that is to play with telephony manager and see what kind of information you can get about cell tower or network. Every network tower have unique id to it and from that you might be able to get an approx estimation depending upon signal strength and stuff of person's location.
I bet it'll be fun and tricky business.
locationManagerNetwork = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
Location location2 = locationManagerNetwork
.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
if (location2 != null) {
String message = String
.format("Yout location : \n Longitude: %1$s \n Latitude: %2$s",
location2.getLongitude(), location2.getLatitude());
Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG)
.show();
//use here file writer if you want to write the coordinates in a text file
}
for writing sd card
File sdcard = Environment.getExternalStorageDirectory();
File f = new File(sdcard, "/yourfile");
if(!f.exsist()){
f.createNewFile();
//Use outwriter here, outputstream search how to write into a file in java code
}