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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:26:46+00:00 2026-05-26T10:26:46+00:00

In my app I have SQLite database that has one table with date rows

  • 0

In my app I have SQLite database that has one table with date rows in milliseconds. I would like to have a notification shown every day IF 30 days has passed since the last date value stored in my database. A service seems to be a good way to accomplish this check up.

I ran into Commonsware’s WakefulIntentService and thought it could be the answer but I really don’t know how should I implement it. In the demo it starts a service after 5 minutes since boot is complete which is just fine but what do I need to add to get it also start at every noon. (… but only to show one notification / day, not both, as from boot and regular daily check up)

I know this could be solved using AlarmManager but really don’t know how. So, the help I need is to give me some samples / key points to get the service start on every boot and/or every day without app running.

thanks

  • 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-26T10:26:46+00:00Added an answer on May 26, 2026 at 10:26 am

    Android alarmmanager is your answer. use it with a broadcast receiver which also resets the alarms on phone wake.

    Now with code example:
    Setting alarm inside a method:

    Intent intent = new Intent(context, AlarmReceiver.class);
    intent.setAction("packagename.ACTION");
    PendingIntent pendingIntent = PendingIntent.getBroadcast(context,
                0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
    Calendar calendar = Calendar.getInstance();
    calendar.setTimeInMillis(System.currentTimeMillis());
            AlarmManager alarm = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
    alarm.cancel(pendingIntent);
    alarm.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), AlarmManager.INTERVAL_DAY, pendingIntent);
    

    Receiver for your interval:

    public class AlarmReceiver extends BroadcastReceiver {
    private final String SOMEACTION = "packagename.ACTION"; //packagename is com.whatever.www
    @Override
    public void onReceive(Context context, Intent intent) {
        Time now = new Time();
        now.setToNow();
        String time = FileHandler.timeFormat(now);
    
        String action = intent.getAction();
        if(SOMEACTION.equals(action)) {
            // here you call a service etc.
        }
    

    Receiver for resetting alarms whenever phone has been shut down.

    public class AlarmSetter extends BroadcastReceiver {
    
        @Override
        public void onReceive(Context context, Intent intent) {
            // get preferences
            SharedPreferences preferences = context.getSharedPreferences("name_of_your_pref", 0);
            Map<String, ?> scheduleData = preferences.getAll();
    
            // set the schedule time
            if(scheduleData.containsKey("fromHour") && scheduleData.containsKey("toHour")) {
                int fromHour = (Integer) scheduleData.get("fromHour");
                int fromMinute = (Integer) scheduleData.get("fromMinute");
    
                int toHour = (Integer) scheduleData.get("toHour");
                int toMinute = (Integer) scheduleData.get("toMinute");
    
                //Do some action
            }
        }
    
    }
    

    Manifest very important, this is added under application:

            <receiver android:name="AlarmReceiver">
            <intent-filter>
                <action android:name="packagename.ACTION"/>
                <action android:name="packagename.ACTION2"/>
            </intent-filter>
        </receiver>
    
        <receiver android:name="AlarmSetter" >
            <intent-filter>
                <action
                    android:name="android.intent.action.BOOT_COMPLETED" />
            </intent-filter>
        </receiver>
    

    Also in order for this to work you need to add permission to receive the boot Broadcast in the manifest with following line:

    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    

    Hope this cleared things up, if any errors plz tell.

    Edit (added alarmsetter example):

    public class AlarmSetter extends BroadcastReceiver {
    
        @Override
        public void onReceive(Context context, Intent intent) {
            // Do your stuff
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an app that must get data from the Sqlite database in order
I have what I would consider a small sized iPhone app that uses SQLite.
I have a SQLite database that I want my app to read and load
I have an app which communicates to webserver. This webserver has SQLite database on
I have a local app that uses SQLite. Whenever it has internet access it
I have a sqlite database that has over 2000 low res thumbnails of pictures.
I have a Sinatra DataMapper app hitting a sqlite3 database that I am attempting
I have an app using SQLite3. It's running pretty well, but I would like
I am looking into writing an Android app that has a database of approximately
I have an iPhone app that has a sqlLite Core Data model that is

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.