I want to sound an alarm and turn it off with a dialog button when an if statement is met.
googleMap.setOnInfoWindowClickListener(
    new OnInfoWindowClickListener() {
        public void onInfoWindowClick(Marker marker) {
            LatLng clickedMarkerLatLng = marker.getPosition();
            lat =  clickedMarkerLatLng.latitude;
            long1 =  clickedMarkerLatLng.longitude;
            String name = marker.getTitle();
            select=true;
            final Location markerLoc = new Location("");
            markerLoc.setLatitude(lat);
            markerLoc.setLongitude(long1);
            final Location location = locationManager.getLastKnownLocation(provider);   
            float distanceBetweenPoints = location.distanceTo(markerLoc);
            TextView t = (TextView) findViewById(R.id.tv_location);
            t.setText("Distance to "+ name +" is "+ distanceBetweenPoints/1000 + " km");
            if (distanceBetweenPoints<1000){
            TextView t2 = (TextView) findViewById(R.id.tv_location);
            t2.setText("ALARMALARMALARM");
            //alarm here
        }
    });
Everything I've found about Alarm Manager doesn't seem to let me use it in the if statement. How would I go about doing this?
 
    