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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T07:31:43+00:00 2026-06-16T07:31:43+00:00

Are there some ways to interact with services as simple as content providers’? I

  • 0

Are there some ways to interact with services as simple as content providers’?

I mean, for example with content providers we have getContentResolver(): easy to query data if you have a Context. You even don’t have to worry about the details of cross-process calls (ContentProvider).

With services, you have to bind them, wait for connection to be established, then make sure to unbind them if you don’t want to leak the memory. Worse, you have to deal with AIDL for remote services.

Taking this example:

I have a file downloader module. Currently there are two approaches: content provider or service. To start every new download, it is easy for both:

  • Service: startService(). You just need a context.
  • Content provider: getContentResolver() and insert the new download into its queue. You also just need a context.

But while the downloads are in progress, I want to obtain some information (average speed, percentage done…). The problem is here: a content provider is more easier to communicate with. Again you just need a context and query the information you want. In case of a service, you need to bind it, unbind it, or build your own AIDL (if it’s a remote service)…

I’m asking this question because with above example, a service seems to be the right approach over a content provider, at least because of its name.

Thanks,

  • 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-16T07:31:44+00:00Added an answer on June 16, 2026 at 7:31 am

    Two ways I would suggest to do this…

    The first is to try using ResultReceiver which implements Parcelable.

    Basically create your own class which extends ResultReceiver then call putExtra(String name, Parceable value on an Intent which you pass in startService(Intent intent) from your Activity. The Service can then use send(int resultCode, Bundle resultData) on the ResultReceiver to send data back. If the ResultReceiver is an inner class of your Activity it will be able to interact with its UI.

    The second possibility is to use Notifications using the FLAG_ONGOING_EVENT flag. This obviously wont appear in the Activity itself but will appear in the Notification bar but you can create a custom RemoteView with a progress and update text etc with each updated notification. This is similar to what you see when Google Play is installing or updating an app on your device.

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

Sidebar

Related Questions

Say you have a std::list of some class. There are two ways you can
And peformance-wise, are there some better ways to do that? for example, create a
Reading some Verilog code, there seem to be two ways of defining arguments in
Out of the various ways to import code, are there some ways that are
I know there are some ways to get the lastchild work for Internet Explorer.
Is there some ways how I could clone StringBuilder ? I am reading files
I'm going to make simple quiz form on site. Are there ways to make
There are some ways to run automatically program on startup under Linux But My
Hiding a DIV would be easy enough in Javascript, but is there some Rails-y
Are there some good resources tutorials or anyone has tried to implement a Capcha

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.