Android GPS-оповещение о близости не работает

Я пытаюсь настроить самое основное оповещение о близости, но, похоже, ничего не происходит. Я'Я довольно новичок в программировании Android, поэтому, пожалуйста, дайте мне знать, что яЯ делаю неправильно или что я пропускаю. Я был вдохновлен некоторыми исходниками здесь иэтот, Вот'мой код:

package com.example.proximityalert;

import android.location.LocationManager;
import android.os.Bundle;
import android.app.Activity;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;

public class MainActivity extends Activity {

    private static final String PROX_ALERT_INTENT = "com.example.proximityalert";
    private IntentReceiver locationReminderReceiver;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


         Intent intent = new Intent(PROX_ALERT_INTENT);
         PendingIntent pendingIntent = PendingIntent.getBroadcast(MainActivity.this, 0, intent, PendingIntent.FLAG_ONE_SHOT);

         LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
         locationManager.addProximityAlert(55.586301,13.045417, 200, -1, pendingIntent);

         this.locationReminderReceiver = new IntentReceiver();

         final IntentFilter filter = new IntentFilter(PROX_ALERT_INTENT);
         this.registerReceiver(this.locationReminderReceiver, filter);

    }
}

и получатель

package com.example.proximityalert;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.location.LocationManager;
import android.util.Log;
import android.widget.Toast;

public class IntentReceiver extends BroadcastReceiver{  

//     @SuppressWarnings("deprecation")
       @Override
       public void onReceive(Context context, Intent intent) {


          String key = LocationManager.KEY_PROXIMITY_ENTERING;

          Boolean entering = intent.getBooleanExtra(key, false);

          if (entering) {
              Toast.makeText(context, "LocationReminderReceiver entering", Toast.LENGTH_SHORT).show();
              Log.i("LocationReminderReceiver", "entering");
          } else {
              Toast.makeText(context, "LocationReminderReceiver exiting", Toast.LENGTH_SHORT).show();
              Log.i("LocationReminderReceiver", "exiting");
          }
       }
    }

Ответы на вопрос(1)

Ваш ответ на вопрос