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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:21:53+00:00 2026-06-16T03:21:53+00:00

This is my code but this calls my activity instead of a function i

  • 0

This is my code but this calls my activity instead of a function i want ,this code runs under a function that is inturn made in a Service:

Intent intent = new Intent(this, abc.class);
        PendingIntent pi = PendingIntent.getService(Server.this, 0, intent, 0);
        AlarmManager almmgr = (AlarmManager) getSystemService(ALARM_SERVICE);
        Calendar cldr = Calendar.getInstance();
        int min1 = cldr.get(Calendar.MINUTE);
        cldr.setTimeInMillis(System.currentTimeMillis());
        cldr.add(Calendar.SECOND, 30);
        almmgr.set(AlarmManager.RTC_WAKEUP, cldr.getTimeInMillis(), pi);

basically I would like to take inputs from 2 timepickers and when the difference of times between these 2 is achieved then call a function which does some control stuff!

  • 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-16T03:21:55+00:00Added an answer on June 16, 2026 at 3:21 am

    So I just want to know how can I use intents etc to call a specific function in the service itself?

    You don’t, at least not directly.

    You can create a service, and you can use a getService() PendingIntent in order to have AlarmManager invoke that service. However, you will get control in onStartCommand(), not some other “specific function in the service itself”. You are welcome to call some other “specific function in the service itself” from onStartCommand() if you wish, but please bear in mind that you are on the main application thread and therefore cannot do very much. If you have a lot of work to do, you might consider creating an IntentService instead of a plain Service, so that you can get control on a background thread (in onHandleIntent()).

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

Sidebar

Related Questions

I am writing this code that one function calls itself recursively. But I am
This code calls in the new data and places it into the div but
I have made an application which calls the phone's contact list but i want
I have an activity that calls the camera intent to capture a picture and
In my main activity, I have the following code that calls my FileBrowser activity:
I have tryed to run this code in my console: script/plugin install git://github.com/apotonick/cells.git ...but
I have write this code but it does work only if I am already
Hey I have this code but it doesn't work because it is expecting a
I tried to use this code but it doesn't work. http://developer.apple.com/library/ios/#samplecode/PageControl/Introduction/Intro.html Ld /Users/waitonza/Library/Developer/Xcode/DerivedData/Dr_Ngoo-aanknxmuodcgjicaigxevljxokeq/Build/Products/Debug-iphonesimulator/Dr Ngoo.app/Dr
I am working on this code but even after consulting other threads I am

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.