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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:52:10+00:00 2026-06-04T07:52:10+00:00

I need to start the activity AlarmReceiver after 10 seconds (for example). I need

  • 0

I need to start the activity AlarmReceiver after 10 seconds (for example). I need it to be activated without running the app. But whether the app runs or not the AlarmReceiver do not get called. Any suggestions?

Intent intent = new Intent(this, AlarmReceiver.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 111, intent, 0);
AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);

//alarmManager.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() 
                                          //+ (10 * 1000), pendingIntent);
Toast.makeText(this, "Alarm set", Toast.LENGTH_LONG).show();
  • 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-04T07:52:11+00:00Added an answer on June 4, 2026 at 7:52 am
    public class AlarmReceiver extends BroadcastReceiver {
    
        @Override
        public void onReceive(Context context, Intent intent) {
              String message = "Hellooo, alrm worked ----";
              Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
              Intent intent2 = new Intent(context, TripNotification.class); 
              intent2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
              context.startActivity(intent2);
        }
    
        public void setAlarm(Context context){
            Log.d("Carbon","Alrm SET !!");
    
            // get a Calendar object with current time
             Calendar cal = Calendar.getInstance();
             // add 30 seconds to the calendar object
             cal.add(Calendar.SECOND, 30);
             Intent intent = new Intent(context, AlarmReceiver.class);
             PendingIntent sender = PendingIntent.getBroadcast(context, 192837, intent, PendingIntent.FLAG_UPDATE_CURRENT);
    
             // Get the AlarmManager service
             AlarmManager am = (AlarmManager) context.getSystemService(context.ALARM_SERVICE);
             am.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), sender);
        }
    }
    

    This is the final code i managed to get working. You need to add

     <receiver  android:process=":remote" android:name="AlarmReceiver"></receiver>
    

    just above the </application> tag in Manifest file.

    This will set an alarm to trigger in 30 seconds after calling the method SetAlarm()

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

Sidebar

Related Questions

I need to change Activity to ListActivity. But I can't start my project... do
I need to start a new activity, after the user clicks on a list
This is my first app and i need to start new activity when the
I need start off with code because I am not sure what terminology to
I need to start a copy of a Rails app from within Java. I
I need to start a program every time the user logs in, but I
In our wicket application I need to start a long-running operation. It will communicate
I need to start an Activity with two different Intent, can I define two
Is it possible to start an Activity in the background? I need such an
I need set the date/time from Android programmatically, but I'm not having success! I

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.