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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:47:04+00:00 2026-06-18T06:47:04+00:00

I tried using ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor(); executor.scheduleWithFixedDelay(new Runnable(){ public void run() { //

  • 0

I tried using

ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
        executor.scheduleWithFixedDelay(new Runnable(){

            public void run() {
                // update server  (method which has asyncTask)
            }

        }, 0, 600, TimeUnit.SECONDS);

And it stops working after mobile sleeps. I would like to do the same using alarmManager but I dont know if I should use service,broadcast service or activity for the requirement above.

Please help me out.

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-18T06:47:05+00:00Added an answer on June 18, 2026 at 6:47 am

    Since you are going to be networking, i would recommend you to use a Service. If you don’t need to keep state in between executions, or don’t want to deal with threads manually, use an IntentService

    This is the code i’m using to set up the a polling service:

        Intent intent = new Intent( context, YourService.class );
        PendingIntent pendingIntent = PendingIntent.getService( context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT );
    
        AlarmManager alarmManager = (AlarmManager) context.getSystemService( ALARM_SERVICE );
        alarmManager.setRepeating( AlarmManager.ELAPSED_REALTIME, POLLING_INTERVAL, POLLING_START_DELAY, pendingIntent );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried using curl syntax: curl http:// localhost:8983/solr/update/csv?stream.file=/usr/local/src/apache-solr-3.6.0/example/exampledocs/my+file.csv&separator=;&stream.contentType=text/plain;charset=utf-8 with no luck. I get: -bash:
I tried using method (foo2) from the template method (foo1) and compiler said that
I tried: using (Entities e = new Entities()) { EntityKey key = new EntityKey(Entities.Users,
Tried using the answer found here: How to run 'cd' in shell script and
tried using the following but it's not the solution controller: var list = new
So tried using an ENUM over instructors favoured 'CHECK(col_name IN ('ENUM', 'LIST')) method and
I tried using CreateProcess to run a simple command like hg > test.txt .
I'm trying to schedule a Clojure function using Executors.newSingleThreadScheduledExecutor(). The annoyance is that calling
I tried using the server-side .CssClass , but this isn't available for me to
I tried using the method described at w3 schools but it seems to only

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.