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 7876731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:12:50+00:00 2026-06-03T03:12:50+00:00

I intend to develop an application that will ask bluetooth turn on and turn

  • 0

I intend to develop an application that will ask bluetooth turn on and turn off timings for days of the week from the user, and then use Alarm Service to do so. I used following grunt code for testing.

Intent myIntent = new Intent(AndroidAlarmService.this, MyAlarmService.class);

 pendingIntent = PendingIntent.getService(AndroidAlarmService.this, 0, myIntent, 0);

       AlarmManager alarmManager = (AlarmManager)getSystemService(ALARM_SERVICE);
       /*
       Calendar calendar = Calendar.getInstance();
       calendar.setTimeInMillis(System.currentTimeMillis());
       calendar.add(Calendar.SECOND, 30);
       alarmManager.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(),  
       pendingIntent);

       */

       Calendar cur_cal = new GregorianCalendar();
       cur_cal.setTimeInMillis(System.currentTimeMillis());
       Calendar cal = new GregorianCalendar();
       cal.add(Calendar.DAY_OF_YEAR, cur_cal.get(Calendar.DAY_OF_YEAR));
       cal.set(Calendar.HOUR_OF_DAY, 13);
       cal.set(Calendar.MINUTE, 23);
       cal.set(Calendar.SECOND, 0);
       cal.set(Calendar.MILLISECOND, cur_cal.get(Calendar.MILLISECOND));
       cal.set(Calendar.DATE, cur_cal.get(Calendar.DATE));
       cal.set(Calendar.MONTH, cur_cal.get(Calendar.MONTH));

   alarmManager.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), pendingIntent);

But this does not trigger my service at 1:30 PM.
The commented out code works fine. it triggers my alarms 30 mins from current time. but when i hard code the time. It doesnt work. I cant figure out the mistake in the code snippet for the Calender cal.

What am I doing wrong?

  • 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-03T03:12:50+00:00Added an answer on June 3, 2026 at 3:12 am

    If you want a repeating alarm you should use alarmManager.setRepeating(...) instead. alarmManager.set(...) would only trigger once.

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

Sidebar

Related Questions

I am trying to develop an android application that will use Bluetooth capabilities to
I intend to develop a J2ME application, that should be able to read words
I intend to develop a application that monitors the traffic on particular ports. For
I am writing a Java application that will load third party drivers. I intend
I want to develop an application (or service) that will count the number of
I intend to make a web application that displays 3d environments that can be
I intend to develop an application using .Net 4.0, and intend to use EF4
I am currently developing a C# Windows Form Application that I intend to let
I'm working on a C++ project that I don't intend to develop or deploy
I would like to develop a mobile application that is able to access all

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.