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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:14:20+00:00 2026-05-22T16:14:20+00:00

I have a public class to make notifications… public class notifyHelper { public void

  • 0

I have a public class to make notifications…

public class notifyHelper  {
public void sendNotification(Activity caller, Class<?> activityToLaunch, String title, String msg, int numberOfEvents, boolean flashLed, boolean vibrate, int ID) {
    NotificationManager notifier = (NotificationManager) caller.getSystemService(Context.NOTIFICATION_SERVICE);

    // Create this outside the button so we can increment the number drawn over the notification icon.
    // This indicates the number of alerts for this event.
    long whenTo = System.currentTimeMillis() + (1000 * 60 * 15);
    final Notification notify = new Notification(R.drawable.icon, "", whenTo);

    notify.icon = R.drawable.icon;
    notify.tickerText = "TV Spored ++";
    notify.when = whenTo;
    notify.number = numberOfEvents;
    notify.flags |= Notification.FLAG_AUTO_CANCEL;

    if (flashLed) {
    // add lights
        notify.flags |= Notification.FLAG_SHOW_LIGHTS;
        notify.ledARGB = Color.CYAN;
        notify.ledOnMS = 500;
        notify.ledOffMS = 500;
        notify.defaults |= Notification.DEFAULT_SOUND;
    }

    if (vibrate) {

        notify.vibrate = new long[] {100, 200, 200, 200, 200, 200, 1000, 200, 200, 200, 1000, 200};
    }

    Intent toLaunch = new Intent(caller, activityToLaunch);
    PendingIntent intentBack = PendingIntent.getActivity(caller, 0, toLaunch, 0);

    notify.setLatestEventInfo(caller, title, msg, intentBack);
    notifier.notify(ID, notify);
}

public static void clear(Activity caller) {
    NotificationManager notifier = (NotificationManager) caller.getSystemService(Context.NOTIFICATION_SERVICE);
    notifier.cancelAll();
}
}

No matter what I do (look whenTo) this notification is always shown when called… How can I set notification time?

Thanks for the answer!

  • 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-22T16:14:21+00:00Added an answer on May 22, 2026 at 4:14 pm

    What makes you think there’s a way to create a notification that is not immediate?

    From http://developer.android.com/reference/android/app/Notification.html you can see a few important things. First, the constructor you’re using is deprecated — you should look to using http://developer.android.com/reference/android/app/Notification.Builder.html instead. More importantly though, the 3rd parameter is not “when to show the notification”, its the time to display in the time field of the notification itself. To visualize this… call your phone and don’t answer (in order to cause a missed call notification). Then pull down your notification drawer and notice the time that gets displayed in the lower right.

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

Sidebar

Related Questions

I have this class: public class Test { public static void main(String[] args) {
In c# you can have public class Foo { public Foo(string name) { //do
Simple question on best practice. Say I have: public class Product { public string
In the main class of my project, I have public class MyClass extends Activity{
Suppose I have public class Parent { private IList<Child> _children; public void AddChild(Child child)
I have these objects: Public Class MakeInfo Public Property Name As String Public Property
When I have a public exposed class, I usually make its member variables private,
I have the following code: class Program { static void Main(string[] args) { string
Suppose I have: public class foobar { public int lorem; public int ipsum; }
Suppose I have public class Product: Entity { public IList<Item> Items { get; set;

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.