Main Menu Location Manager

Locator.xml

<Button android:id="@+id/btnSubmitAudio"

android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_gravity="center" android:text="Record &amp; Submit Audio Report" android:padding="10sp"/>

((Button)findViewById(R.id.btnSubmit Audio)).setOnC!ickListener(this);

LocationFormActivity.java public void startGPS () {

//—use the LocationManager class to obtain GPS locations—

lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE); locationListener = new MyLocationListener();

if (lm.isProviderEnabled(LocationManager.GPS_PROVIDER)) {

Log.i(TAG, "starting up GPS location provider..."); lm.requestLocationUpdates(

LocationManager.GPS_PROVIDER,

LOCATION_UPDATE_TIME, LOCATION_UPDATE_DISTANCE, locationListener);

currentLocation = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER); updateLocation (currentLocation);

if (lm.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) {

Was this article helpful?

0 0

Post a comment