메인액티비티에서 사용자가 원치 않을 경우 on/off 버튼을 누르면

다른 서비스에 지정된 알람을 해제 시키고 싶은데 방법이 없을까요?


Intent mintent = new Intent(auto.this, AM.class);

PendingIntent msender = PendingIntent.getBroadcast(auto.this,0, mintent, 0); 

AlarmManager mam = (AlarmManager)getSystemService(ALARM_SERVICE);

mam.setRepeating(AlarmManager.RTC,  firstTime, 60000, msender);

auto라는 서비스에 있는 알람매니저 구요


Intent mintent = new Intent(MainActivity.this, AM.class);

PendingIntent msender = PendingIntent.getBroadcast(MainActivity.this, 0, mintent, 0);

AlarmManager mam = (AlarmManager)getSystemService(ALARM_SERVICE);

mam.cancel(msender);


취소 버튼 눌렀을때 취소시키는 부분인데요


저렇게 해도 취소가 안되더라구요 ㅠㅠ