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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:41:28+00:00 2026-05-28T02:41:28+00:00

I have an app which downloads a timetable and saves it, it also regularly

  • 0

I have an app which downloads a timetable and saves it, it also regularly downloads changes to this timetable. I’m currently using a singleton, but I find this ugly from a design perspective. Because of the downloads I need a centralized system to minimize network usage.

In the current situation, every class that requires updates from the singleton first gets an instance of this singleton and then provides an interface of which certain methods are called when an update is required. Currently the singleton handles all of the downloads in worker threads. Normally I would use an AsyncTask, called from the Activity, however because I have to send the result to the widget too, I can’t see this work.

The alternative is using a Service. I would simply bind to it from both the widget and the activity. The problem in this case is that I can’t bind from a BroadcastReceiver (which an AppWidgetProvider is). The issue would be that I can’t regularly update my widget.

My question is: how can I (or: can I) design my app in such a way that I can update my widget from a service (in order to get rid of the singleton) or is there a better way (maybe BroadcastReceivers)?

  • 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-28T02:41:29+00:00Added an answer on May 28, 2026 at 2:41 am

    how can I (or: can I) design my app in such a way that I can update my widget from a service (in order to get rid of the singleton) or is there a better way (maybe BroadcastReceivers)?

    To update an app widget, call updateAppWidget() on an AppWidgetManager. This can be done at any point, not just from an AppWidgetProvider.

    To update an app widget on a periodic basis, either use android:updatePeriodMillis in your app widget metadata, or set up AlarmManager directly yourself. In either case, you would want to delegate the work to an IntentService, as “downloads a timetable” is not something you want to do on the main application thread — IntentService gives you a background thread and automatically stops itself when your work is complete, so you do not take up RAM except when you are actively doing work.

    To do work in general on a periodic basis, use AlarmManager and an IntentService. The IntentService can, as part of its work, update app widgets, if desired.

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

Sidebar

Related Questions

i have a video app which downloads and save many videos using NSURLConnection. I
I have a small Silverlight app which downloads all of the images and text
I'm developing an app which downloads a json objects into database,this is done so
The games prevent this by making the core app only which then downloads the
I have a project which downloads images in background using NSOperationQueue . It was
Hi I love this application http://www.stardock.com/products/fences/downloads.asp and I have written an app that puts
I have to write a small app which downloads a few thousand files. Some
I am currently developing an app which downloads information from a webservice which I
In my app I have a background task (using AsyncTask) that downloads stuff from
I have an app which downloads images from a server, stores them on the

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.