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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T00:32:52+00:00 2026-05-30T00:32:52+00:00

I start a service using alarm manager using button click. It is working too.

  • 0

I start a service using alarm manager using button click. It is working too. I have done it this way:

    Intent scheduleSMS = new Intent(SMSProjectDatabase.this,SendSMS.class);
    PendingIntent pendingIntent = PendingIntent.getService(SMSProjectDatabase.this,0, scheduleSMS,0);
    AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);

    Calendar calendar = Calendar.getInstance();

    calendar.setTimeInMillis(System.currentTimeMillis());
    calendar.add(Calendar.SECOND,(int)GeneralUtil.calculateTimeDifference(getApplicationContext()));
    Log.i("SMS is scheduled after ",""+GeneralUtil.calculateTimeDifference(getApplicationContext()));

    alarmManager.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), pendingIntent);

Here SendSMS is a service that will be started by the alarm manager. But this is not how i want to start a service in my code. I want to Use the Alarmmanager to trigger a broadcast for the Broadcastreceiver. The Broadcastreceiver then starts the Service for me.

My BroadCast Receiver is

public class MyReceiver extends BroadcastReceiver{

@Override
public void onReceive(Context context, Intent intent) {
    //here i want to start the service through the alarm manager

}

}

But i donno how am i supposed to do this.Please provide the appropriate solution for me to solve this problelm.

  • 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-30T00:32:54+00:00Added an answer on May 30, 2026 at 12:32 am

    You just simply need to put your stuff for calling Service using AlarmManager inside the onReceive()

    @Override
    public void onReceive(Context arg0, Intent arg1) {
      // To get AlarmManager instance working you can use Context arg0
      AlarmManager alarmManager = (AlarmManager) 
                                               arg0.getSystemService(ALARM_SERVICE); 
      // put your stuff to start Service using AlarmManager
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I start service by using: private ServiceConnection _serviceConnection = new ServiceConnection() {...} bindService(new Intent(this,
In my application, I am trying to start a service using Alarm manager. When
i am using a web service. i have to start that particular service at
I'm looking at using the Alarm Manager, and read this in the developer docs,
I'm trying to install a service using InstallUtil.exe but invoked through Process.Start . Here's
I am trying to start a service from the command line using net start
How to start and and stop a Windows service remotely using PSEXEC? Preferably the
I'm trying to start a Wicket Application using Felix implementation of OSGi HTTP service,
Ok so to start off, I'm not using any sort of web service. Right
I have an executable that is started by a windows service, this program will

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.