Back to project page lost-phone-tracker-app.
The source code is released under:
MIT License
If you think the Android project lost-phone-tracker-app listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package at.fhj.ase13.mobcomp2.phonetracker; // w w w .ja v a 2 s . c om import android.content.Context; import android.location.Location; import android.location.LocationManager; import android.telephony.SmsManager; public class SmsLocationReporter { private Context context; private String receiver; public SmsLocationReporter(Context context, String receiver) { this.context = context; this.receiver = receiver; } public void report() { LocationManager locationManager = (LocationManager) context.getSystemService( Context.LOCATION_SERVICE); String usedProvider = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER) ? LocationManager.GPS_PROVIDER : LocationManager.NETWORK_PROVIDER; Location location = locationManager.getLastKnownLocation(usedProvider); if (location == null) { return; } SmsManager smsManager = SmsManager.getDefault(); smsManager.sendTextMessage(receiver, null, context.getString(R.string.report_text, location.getLatitude(), location.getLongitude()), null, null); } }