When the users presses the start button , a check runs to see if GPS is enabled and then starts an activity.The checkGPS uses alertmanager.
case R.id.startbt         
        
1) in onCreate() method, register LocationListener on your Activity : 
   // get location manager
   LocationManager lManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); 
   Button btnStart = (Button)findViewById(R.id.btnStart);
   btnStart.setOnClickListener(new OnClickListener() {
       @Override
       public void onClick(View v) {
            lManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, YourActivity.this);
       }
   });
2) your activity should implement LocationListener:
   public class YourActivity extends Activity implements LocationListener {
3) override methods of LocationListener :
@Override
public void onLocationChanged(Location location) {
     // when the position has changed
     Log.d(TAG, "location changed.");
}
@Override
public void onProviderDisabled(String provider) {
     // when the source (GSP or GSM network) are disabled
     Log.d(TAG, "the source "+provider+" has been disabled");
}
@Override
public void onProviderEnabled(String provider) {
     Log.i(TAG, "the source "+provider+" has been enabled");
     //here you should test if the provider enabled is GPS , if yes , then launch your GPSActivity
     if(provider.equals("gps") {
           Intent gpslocation=new Intent(this,selection.class);
           startActivity(gpslocation);
     }
     else {
           //launch your alert dialog here
     }
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
     Log.i(TAG, "source status "+provider+" has been changed to : "+status);
}