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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:18:05+00:00 2026-05-25T18:18:05+00:00

I am designing an application that needs to update a server at regular intervals,

  • 0

I am designing an application that needs to update a server at regular intervals, but I am unsure of how to go about sending these updates.

This is what I am trying to do:
When my Activity starts, I must send an initial connection message to the server. After the connection has been established, I will send one new message to the server every second. When the user performs some action that the server needs to know about, that message will be added to a queue. Every second or so, my app would then check the queue for messages to send. If one is available, it is sent. If the queue is empty, a simple Keep Alive message should be sent to maintain the connection.

My question is, what would be the best strategy for me to implement this? Should I be using a separate Thread? Or a Service? Or AsyncTasks?

My thoughts so far: The connection does not need to be maintained past
the lifecycle of the activity, so it seems to me that a Service would
be overkill.

And how should I handle scheduling the updates? Should I be using a MessageQueue with a Looper? Or a ScheduledExecutorService? Or a Handler?

My thoughts so far:
My understanding is that MessageQueue blocks until it receives a
message to send.
I’m not sure this is what I want. My plan was just to send Keep
Alive messages
when the queue is empty, not block until a new message arrives.

I’m totally new to this sort of stuff so I might be going about this entirely the wrong way. I’d be happy to hear any advice you can offer.

  • 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-25T18:18:06+00:00Added an answer on May 25, 2026 at 6:18 pm

    I would use a separate thread with a sleep statement (or android equivalent) … keeping it as simple as possible is necessary with your intended timings and the fact that the app is not intended for unattended execution

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

Sidebar

Related Questions

I am designing an application that needs to save geometric shapes in a database.
I am designing a web application that does server side image processing in real
I am designing an application that needs to load HTML content from a specific
As part of my final year project, I'm designing an Android application that needs
I am designing a Web application that we estimate may have about 1500 unique
I am designing an application that will retrieve .zip files from a server and
I am designing an application that is going to consist of 3-4 services that
I'm designing an application that supports plugin development. Its more of a learning exercise.
I'm designing an application that reads data to the iPod touch/iPhone that is sent
I'm designing an application that receives information from roughly 100k sensors that measure time-series

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.