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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:05:28+00:00 2026-06-09T09:05:28+00:00

hey guys i am working on android application , i am trying to creat

  • 0

hey guys i am working on android application , i am trying to creat a notification for a specific time like ( 03 – august -2012 at 5:00 pm ) , so i used the calender to set the time and then using calendar.getTimeInMillis i get the time of the notification , but unfortunatlly when i run my application on the emulator once the application starts the notification appears without caring about the specfic time, i.e its not 4:00 pm the notification appears on the top and time stamped with 5:00pm , heres my notification code :

String ns = Context.NOTIFICATION_SERVICE;
NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns);

int icon = R.drawable.ieee;
CharSequence tickerText = "Hello";

//   long when = System.currentTimeMillis();

//setting custom time 
Calendar calendar = Calendar.getInstance();
calendar.set(calendar.DAY_OF_MONTH,03);
calendar.set(Calendar.HOUR_OF_DAY,17);
calendar.set(Calendar.MINUTE,26);
calendar.set(Calendar.SECOND, 00);
long when = calendar.getTimeInMillis();        // notification time

Notification notification=new Notification (icon, tickerText, when);

Context context = getApplicationContext();
CharSequence contentTitle = "My notification";
CharSequence contentText = "Hello World!";
Intent notificationIntent = new Intent(this, MainActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
notification.flags |= Notification.FLAG_AUTO_CANCEL;
notification.flags |= Notification.FLAG_ONLY_ALERT_ONCE;
notification.flags |= Notification.FLAG_SHOW_LIGHTS;
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
mNotificationManager.notify(1, notification);

now everything is running , but there’s a little problem ,,, for example if the date&time now is 9/9/2012 , 9:00 am ,,, and i set the alarm for tomorrow at 10am , okey it will work , but when i open the application the day after tomorrow first thing the app will do is to do notification of the old alarm , i tried this by setting old alarm dates and when i open the app the first thing it does is showing old alarms , so any ideas about solving this ?

  • 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-09T09:05:29+00:00Added an answer on June 9, 2026 at 9:05 am

    Because it will not wait when you haven’t told it to. You can’t set the Calendar time and then expect the notification service to wait.

    You need to instead using a TimerTask or AlarmManager for this to generate an event at the time you want. Then create the notification inside your implementation of either one.

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

Sidebar

Related Questions

Hey guys I am working on android application. My app includes an activity which
hey guys im working on a task to make my story's links like this
Hey guys. I'm working in WinForms and trying to create a ComboBox control that
Hey guys and gals I'm having some major issues trying to get my application
Hey guys i am currently working on an android app that will allow me
Hey guys I'm working on a chunk of my function and trying to keep
Hey guys. Working on Mac OSX 10.6, My problem is that I would like
Hey guys! I've been working on c++ application lately which has to be run
Hey guys, I'm studying for a midterm right now and am working on trying
Hey guys i'm trying to figure out how to subtract one time from another

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.