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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:09:55+00:00 2026-06-07T05:09:55+00:00

I am trying to figure out how I should launch a notification. Creating the

  • 0

I am trying to figure out how I should launch a notification. Creating the notification is not what I am asking, but rather a way to launch it in the background so its unobtrusive and the user can do whatever they were doing. Its for a calendar, a reminder to be exact. It is also important to note I am using AlarmManager.

  1. What method should I use to run it in the background. BroadCastReciever, Service, etc.

  2. Research I have found also presents a problem with AlarmManager. When the app is killed or phone is turned off, the alarm is also. What other method should I use in order to make sure the notification is guaranteed to show for that event reminder?

If any additional info is needed please ask and I shall do so. Thanks in advance.

  • 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-07T05:09:58+00:00Added an answer on June 7, 2026 at 5:09 am

    Create a broadcastreceiver or intentservice. Then…

    AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
    
    
    Date date = new Date(); //set this to some specific time
    or Calendar calendar = Calendar.getInstance();
    
    //set either of these to the correct date and time. 
    
    then 
    Intent intent = new Intent();
    //set this to intent to your IntentService or BroadcastReceiver
    //then...
    PendingIntent alarmSender = PendingIntent.getService(context, requestCode, intent,
                                PendingIntent.FLAG_CANCEL_CURRENT);
    //or use PendingIntent.getBroadcast if you're gonna use a broadcast
    
                    alarmManager.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), mAlarmSender); // date.getTime to get millis if using Date directly. 
    

    If you’d like these alarms to work correctly even when the phone is restarted, then add:

            <action android:name="android.intent.action.BOOT_COMPLETED"/>
    

    as intentfilter on your Receiver in the manifest and recreate your alarms in onReceive.

    EDIT

    When you create a BroadcastReceiver in your application, it allows to do exactly what it sounds like: receive broadcasts in the system. So for example, you might some BroadcastReceiver like so:

    public class MyAwesomeBroadcastReceiver extends BroadcastReceiver {
    
    //since BroadcastReceiver is an abstract class, you must override the following:
    
        public void onReceive(Context context, Intent intent) {
           //this method gets called when this class receives a broadcast
        }
    }
    

    To send broadcasts to this class explicitly, you define the receiver inside of the manifest, as follows:

    <receiver android:name="com.foo.bar.MyAwesomeBroadcastReceiver" android:enabled="true" android:exported="false">
                <intent-filter>
    
                    <action android:name="SOME_AWESOME_TRIGGER_WORD"/>
                    <action android:name="android.intent.action.BOOT_COMPLETED"/>
    
    
    
    
                </intent-filter>
            </receiver>
    

    Having this in the manifest gets you two things: You can send a broadcast explicitly to your receiver whenever you want by

    Intent i = new Intent("SOME_AWESOME_TRIGGER_WORD");
                    sendBroadcast(intent);
    

    Also, since you’ve told android you’d like to receive the BOOT_COMPLETED action which is broadcast by the system, your receiver will also get called when that happens.

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

Sidebar

Related Questions

Trying to figure out the best way to do this: Should I do something
I'm trying to figure out whether I should avoid looping through arrays this way
I am trying to figure out where should I put database operation for each
I'm trying to figure out what logic should go into the different UIViewController methods
I'm trying to figure out if I should continue on with a current pattern
Trying to figure out why my recipient multiselect isn't validating on form submission. Should
I'm trying to figure out how my iOS app should work after Facebook make
I am trying to figure out under what circumstances I should use weak (non-identifying)
I'm trying to figure out how my new app should handle data. In previous
I am trying to figure out what type of structure or container I should

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.