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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:31:02+00:00 2026-06-10T07:31:02+00:00

I would like to achieve this: After first turning on the application, user receives

  • 0

I would like to achieve this:

After first turning on the application, user receives notifications, every day at 2pm, if certain condition is true. If condition is false, we are not showing a notification this day. The condition is checked at 2pm, it downloads some data from the Internet.

So far I used AlarmManager and its method setRepeating() with 24h interval. AlarmManager fires up a Service. In this Service I’m downloading the data, checking condition and if it’s true – showing Notification. Since downloading can last more than 5 seconds, I’ve declared android:process=":background" for this Service, to run it in separate process and not block my UI.

This approach has two drawbacks:


1: If user opens application let’s say at 4pm (and the condition is true), he will receive the notification immediately. From setRepeating() documentation:

If the time occurs in the past, the alarm will be triggered
immediately, with an alarm count depending on how far in the past the
trigger time is relative to the repeat interval.

I would like that user will not receive a notification this day, only the next day and so on.


2: I’m worried that my notifications will not show after user switch the phone off. From AlarmManager documentation:

Registered alarms are retained while the device is asleep (and can optionally wake the device up if they go off during that time), but will be cleared if it is turned off and rebooted.

I don’t know if it’s possible to make it work all the time.


If you have any ideas how to make it better, you’re welcome.

  • 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-10T07:31:04+00:00Added an answer on June 10, 2026 at 7:31 am

    1: I’m not quite sure if i understood your question, but I think all you have to do is if it already is past 2pm add a day to 2pm:

    GregorianCalendar twopm = new GregorianCalendar();
    twopm.set(GregorianCalendar.HOUR_OF_DAY, 14);
    twopm.set(GregorianCalendar.MINUTE, 0);
    twopm.set(GregorianCalendar.SECOND, 0);
    twopm.set(GregorianCalendar.MILLISECOND, 0);
    if(twopm.before(new GregorianCalendar())){
        twopm.add(GregorianCalendar.DAY_OF_MONTH, 1);
    }
    alarmManager.setRepeating(type, twopm.getTimeInMillis(), 1000*60*60*24, intent);
    

    2: You could register a BroadcastReceiver for booting and start your alarm again there. Take a look at this: Android BroadcastReceiver on startup – keep running when Activity is in Background

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

Sidebar

Related Questions

I would like to achieve this functionality. <p:column> <p:commandLink value=prihlasit oncomplete=dlg.show(); action=#{signForProjectBean.setProjectForDetail(item)} /> </p:column>
I would like to ask is there any way to achieve this functionality: I
I have this code and don't know if what I would like to achieve
I would like to achieve the following: I want a free Application Lifecycle Management
What I would like to achieve here is a user selects an operator, e.g.
I would like to add two lines after the first string search. I am
The first thing i would like to say is that this is not exactly
I would like to achieve something very similar to Microsoft Access query designer -
I would like to achieve the following: On homepage load, display modal box Within
I would like to achieve something similar to how scala defines Map as both

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.