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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:32:04+00:00 2026-05-24T17:32:04+00:00

I have a service that keeps running, and a Timer in there to execute

  • 0

I have a service that keeps running, and a Timer in there to execute a certain function every X minutes.

From an activity, I’d like this function to be called immediately when something happens, so we don’t need to wait untill the function is called by the Timer. Is that possible?

If you like a less ‘general’ question:

  • I have a database with queued messages (queuing is done in case no network is available).
  • Every X minutes, my service checks if network is available, and flushes the queue to the server
  • Now, what I’d like to achieve is that I can trigger this “flushing” of the queue as soon as I’ve added an item to it (from within an activity).

Is that possible?

  • 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-24T17:32:05+00:00Added an answer on May 24, 2026 at 5:32 pm

    One approach could be to use a Messenger. When a FLUSH_QUEUE message comes in, handle it by flushing the queue immediately.

    • The service can create an AsyncTask or thread that sends messages based on a timer, so every X minutes, a message is sent and handled, and the queue is flushed
    • An activity can bind to the service, and send a message whenever it wants, flushing the queue on demand
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a service that needs to update the registry every 5 minutes (counteract
I have a Windows service running in local system that simply keeps trying to
I have a ruby service that keeps running forever and I wonder whats the
I have a service that accepts callbacks from a provider. Motivation : I do
I have a service that I would like it to become single instance, because
I have a service that has a dependency on SQL server express (2005). Every
I have an Activity that starts a Service. In my Activity: startService(new Intent(this, MyService.class));
Writing a Service that is running on IIS. Basically looks like this: void ProcessRequest(HttpContext
We have a service that has some settings that are supported only over net.tcp.
We have a service that runs methods used for data import/export at specified intervals.

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.