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

  • SEARCH
  • Home
  • 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 6554083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:39:29+00:00 2026-05-25T12:39:29+00:00

Hi i am new to android i am developing alarm application for that i

  • 0

Hi i am new to android i am developing alarm application for that i need to invoke alarm repeatedly for the same time in different days selected by the user. what i meen if i set alarm time as 10AM and repeat option as sunday, monday, saturday the alarm will be invoked on every sunday,monday,saturday.

Here i am using the code to invoke the alarm

AlarmManager am = (AlarmManager)getSystemService(ALARM_SERVICE);
                Intent intent = new Intent(Alarm.this, OneShotAlarm.class);  //here i am calling broad \cast receiver to invoke alarm

                 PendingIntent sender = PendingIntent.getBroadcast(Alarm.this, requestCode, intent, 0);
                 Calendar calendar = Calendar.getInstance();
calendar.set(Calender.HOUR_OF_DAY,10); 
                am.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), sender);

By using this code i am invoking present day at 10AM.But my gole is need to invoke the alarm for selected days at 10AM.

Here i have another question please help for this also. When i am trying to put the passed time the alarm will be invoked for the current time. How can i give the past time. i mean when i am at 11AP i am need to give 9AM.

Please suggest me if there is any way.
Thanks in advance.

  • 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-05-25T12:39:30+00:00Added an answer on May 25, 2026 at 12:39 pm

    Please Write below Code in your Broadcast Receiver Class, it will solve your problem.

    public class MyBroadcastReceiver extends BroadcastReceiver {
        DBAdapter mDba;
        SQLiteDatabase mDb;
        Ringtone rt;
        MediaPlayer mp;
        AlertDialog.Builder alertbox;
        Context ctx;
    
        @Override
        public void onReceive(Context context, Intent intent) {
    
            DBHelper mDbh = new DBHelper(context, null, null, 1);
            mDb = mDbh.getWritableDatabase();
            mDb.setLockingEnabled(true);
            mDba = new DBAdapter(context);
            mDba.open();
            Cursor cr = mDb.query("mReminderEntry", null, null, null, null,
                    null, null);
            if (cr.equals(null)) {
                System.out.println("No Data Found");
            } else {
                Date d = new Date();
                System.out.println("Current Hour is:- " + d.getHours());
                System.out.println("Current Minute is:- " + d.getMinutes());
                Calendar calendar = Calendar.getInstance();
                int day = calendar.get(Calendar.DAY_OF_WEEK);
                String today = null;
                if (day == 2) {
                    today = "Monday";
                } else if (day == 3) {
                    today = "Tuesday";
                } else if (day == 4) {
                    today = "Wednesday";
                } else if (day == 5) {
                    today = "Thursday";
                } else if (day == 6) {
                    today = "Friday";
                } else if (day == 7) {
                    today = "Saturday";
                } else if (day == 1) {
                    today = "Sunday";
                }
                System.out.println("Today is:- " + today);
    
                int system_hour = d.getHours();
                int system_minute = d.getMinutes();
                cr.moveToFirst();
                for (int i = 0; i < cr.getCount(); i++) {
                    if (cr.getString(3).equals(system_hour + ":" + system_minute)
                            && cr.getString(1).equals("Daily")) {
    
                        System.out.println("Matched");
                        Intent scheduledIntent = new Intent(context, MyScheduledActivity.class);
                        scheduledIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                        context.startActivity(scheduledIntent);
    
                        break;
    
                    } else if (cr.getString(3).equals(
                            system_hour + ":" + system_minute)
                            && cr.getString(1).equals(today)) {
    
                        Intent scheduledIntent = new Intent(context, MyScheduledActivity.class);
                        scheduledIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                        context.startActivity(scheduledIntent);
    
                        System.out.println("Matched");
    
                        break;
                    } else {
                        System.out.println("No Matching");
                    }
                    cr.moveToNext();
                }
            }
            cr.close();
            mDba.close();
        }
    }
    

    If U have any issue regarding that then tell me.

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

Sidebar

Related Questions

I new in the android developing. I want to develop simple application that will
I'm new in the android developing. I need to write some simple application -
Hello i am new in developing Android applications, I need to create an application
Hi i am new to android. I am developing a application with alarm functionality.
I'm new to android developing but right now I'm working on an application that
I start developing a new Android application from scratch these days. The company I
I have been developing Android application where I use this code: Date d=new Date(new
he, i am new to android platform. Now i am developing a small application
I am new in developing android applications. I want to create an android application(using
I am developing a small android application. When the user hasn't signed up, he

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.