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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T02:46:19+00:00 2026-06-07T02:46:19+00:00

I’m creating an queued upload manager. With this answer to my previous question’s guidance,

  • 0

I’m creating an queued upload manager. With this answer to my previous question’s guidance, I’ll be using a Service, to upload these images. It was recommended that I use a database to keep track of the successfully uploaded, and the pending files.

My initial research leads me to believe that I’ll want to create a Bound Service, so I can update my UI once the photos have uploaded, as well as a Started Service, so it can run independent of my Activities that create it. It seems that I’ll also need to start it in its own process via the process=":something" directive in the app manifest.

My question is, what would the best way of sharing an SQLite (unless there is a better way) database amongst the N activity clients and the uploader service?

I envision it working like this, in pseudo code:

// in an app
writeRecordToDb( . . . );

// start service
if( service doesn't exist )
{
  // start service, and bind
}

// in the service:
if( shared db has another row )
{
  doDownload( . . . );

  if( download worked )
  {
    notifyActivity();

    if( db has another row )
      doDownload( . . . );
  }
  else
  {
    retryDownload( . . . );
  }
}

Is this the correct way to go about this? I’m again attempting to circumvent the problem of having multiple Activity instances request photo uploads when there is little to no cellular signal. I’ve just finished reading though the Service and Bound Service docs, and I’m feeling good, but not great.

  • 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-07T02:46:22+00:00Added an answer on June 7, 2026 at 2:46 am

    My initial research leads me to believe that I’ll want to create a Bound Service

    I wouldn’t.

    so I can update my UI once the photos have uploaded

    You do not need to use the binding pattern to update the UI. You can:

    • send a local broadcast using LocalBroadcastManager that the activity picks up, or
    • invoke a PendingIntent supplied in an Intent extra on startActivity() by the activity, or
    • give Square’s Otto event bus a try (looks interesting, but I haven’t used it yet)
    • etc.

    as well as a Started Service, so it can run independent of my Activities that create it

    Which is why you should not bother with binding, as you do not need that, but you do need to start the service.

    My question is, what would the best way of sharing an SQLite (unless there is a better way) database amongst the N activity clients and the uploader service?

    Option #1: Keep your SQLiteOpenHelper in a static data member

    Option #2: Use a ContentProvider wrapper around your database

    Is this the correct way to go about this?

    Using a database as a communications channel between components is akin to two next-door neighbors communicating with each other using a banner towed by a biplane. Yes, it works. However, it is slow and expensive.

    (also, there’s never a biplane when you need one, but I digress…)

    If you wish to use a database as a backing store for pending downloads, in case there is some interruption (e.g., user powers down the device) and you wish to pick up those downloads later on, that’s fine. However, the service will know what to download by the command you send to it via startService().

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I am using Paperclip to handle profile photo uploads in my app. They upload
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

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.