Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8190121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:31:01+00:00 2026-06-07T03:31:01+00:00

I am trying to make an alarm that would ring at specified n number

  • 0

I am trying to make an alarm that would ring at specified n number of times. My code is given below. I am able to get the entries correctly but no alarm rings at all.

public void setAlert(View view) {

    int h[] = new int[TOTAL_ALARMS];
    int m[] = new int[TOTAL_ALARMS];
    Intent intent[] = new Intent[TOTAL_ALARMS];
    PendingIntent pendingIntent[] = new PendingIntent[TOTAL_ALARMS];
    int piID = 12345; 
    Calendar[] cal = new Calendar[TOTAL_ALARMS];
    for (int i = 0; i < TOTAL_ALARMS; i++) {
        cal[i] = Calendar.getInstance();
    }

    for (int i = 0; i < TOTAL_ALARMS; i++) {
        try {

            m[i] = Integer.parseInt(editHour[i].getText().toString());

            h[i] = Integer.parseInt(editMinute[i].getText().toString());

            cal[i].set(Calendar.HOUR, h[i]);
            cal[i].set(Calendar.MINUTE, m[i]);


            intent[i] = new Intent(this, AlarmService.class);
             pendingIntent[i] = PendingIntent.getActivity(this,
                    piID++, intent[i], PendingIntent.FLAG_CANCEL_CURRENT);
            AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
            alarmManager.set(AlarmManager.RTC_WAKEUP,
                    cal[i].getTimeInMillis(), pendingIntent[i]);
            Toast.makeText(this, "Alarm set", Toast.LENGTH_LONG).show();

        } catch (Exception ex) {
            ex.printStackTrace();
            System.out.print("OOPS!");

        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T03:31:03+00:00Added an answer on June 7, 2026 at 3:31 am

    I just answered same question, You are missing defining Receiver in Manifest withe specific intent.

    Answer link

    And you must change Second parameter from “123” to random and unique number you can do it by have a int count, and use count ++ in pending intent in place of 123 // fixed

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to make an alarm application that will take ‘n’ number of
I'm trying to make an alarm clock in which you can set multiple times.
I am trying to make a simple alarm. in this code portion a take
Im trying to make an app, that would remind me of an event at
I am trying to make alarm ring when the time of calendar event is
I am trying to make an alarm application, and found this code online. But
I just went through trying to make an alarm clock app with local notifications
I'm trying make an entity with doctrine that has three associations with other entities
Trying to make this jQuery filter that uses .find case-insensitive. For example, when the
I'm trying to make alarm in my app. I made UILocalNotification and it works

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.