Welcome to the Android Central Forums Create Your Account or Ask a Question Answers in 5 minutes - no registration required!
Results 1 to 1 of 1
  1. Thread Author  Thread Author    #1  

    Question Enabling & Disabling Alarm

    Hi All,

    I am developing one application for that I have created a AlarmReceiver file that receives alarm events.

    There is a two Alarms in my app. Lets say one is starting a radio at particular time and other is stopping it.

    The things are working fine but when the user disable and then re-enable the alarm the onReceive() method of AlarmReciever is getting called as and when user re-enable the alarm.

    When a user clicks on disable alarm I simple store the current time which was set by the user previously. Later whenever the user comes and re-enable the alarm I just create a alarm with the previously stored time but the onReceive() method getting called instantlly.

    How I disable the alarm:
    Before disabling alarm I store the current value of Alarm.
    AlarmManager alarmManager = (AlarmManager) this.getSystemService(Context.ALARM_SERVICE);
    PendingIntent sender = = PendingIntent.getBroadcast(this, 1, intent, 0); // 1 for 1st alarm and 2 for 2nd alarm
    alarmManager.cancel(sender);

    I am not unregistering the BraodcastReciever as I don't know how to disable one receiver of AlarmReciever?

    How I set bot the Alarm with unique alarm code...
    alarmManager.setRepeating(AlarmManager.RTC, time, AlarmManager.INTERVAL_DAY, PendingIntent.getBroadcast(this, alarmUniqueCode, intentAlarm, PendingIntent.FLAG_UPDATE_CURRENT));

    Please help!

Similar Threads

  1. Disable Google Search Hotword Detection?
    By radgatt in forum Moto X (2013)
    Replies: 17
    Last Post: 04-20-2014, 05:52 PM
  2. alarm not sounding.....note one jellybean
    By notedude3 in forum Samsung Galaxy Note
    Replies: 5
    Last Post: 04-12-2014, 09:55 AM
  3. Download Booster disables on T-Mobile too...
    By Xm_jdm in forum Samsung Galaxy S5
    Replies: 2
    Last Post: 04-09-2014, 10:12 PM
  4. Disable autofocus when recording video?
    By linbmcd in forum Samsung Galaxy S4
    Replies: 1
    Last Post: 04-09-2014, 06:30 PM

Posting Permissions