특정 지점을 등록하는 경우 addProximityAlert함수를...
해제할려면 removeProximityAlert함수를 쓰는 걸로 알고 있습니다.
만약에 지점 여러개를 등록을 하고 기존에 등록된 모든 지점들을 해제하고 싶으면 어떻게 해야할까요?
public void ProximityAlertUpdate(String locality){
if(proximityIntent!=null){
locationManager.removeProximityAlert(proximityIntent);
}
receiver=new ProximityAlertBroadcastReceiver();
IntentFilter filter=new IntentFilter("com.example.ab.location7");
registerReceiver(receiver,filter);
Intent intent=new Intent("com.example.ab.location7");
proximityIntent= PendingIntent.getBroadcast(getApplicationContext(), 0, intent, 0);
for(int i=0; i<BranchGPSManger.getBranchGPSDataArrayList().size();i++){
if(locality.equals(BranchGPSManger.getBranchGPSDataArrayList().get(i).getLocality())){
locationManager.addProximityAlert(BranchGPSManger.getBranchGPSDataArrayList().get(i).getLatitude(),BranchGPSManger.getBranchGPSDataArrayList().get(i).getLongitude(),5000,-1,proximityIntent);
}
}
}
제가 짠 함수인데요...사용자의 위치가 성북구이면 지점 데이터들 중에 성북구인 지점만 골라서 반복문으로 다 등록을 해줍니다..이렇게 여러번 등록을 했는데.. 코드 처음에보면 해제는 한번만 해주고 있거든요..지금 서버쪽이 이상해서 테스트를 할수 없네요 ㅠ 이렇게 해제를 한번만 해줘도 되는걸까요?