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

  • Home
  • SEARCH
  • 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 6539879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:54:42+00:00 2026-05-25T10:54:42+00:00

I am writing an Android application that interfaces with a RESTful service. This web

  • 0

I am writing an Android application that interfaces with a RESTful service. This web service essentially fronts a file system, and provides metadata as well CRUD access to the files. My application retrieves the metadata, and exposes it to 3rd party apps through a ContentProvider.

I need to add the ability for 3rd party applications, running on the same device as my app, to CRUD the actual files by making requests to/from my app (not directly with the server). This means they need to either send or receive the contents of the files (which are typically XML or images) through my app.

I have thought of two approaches for implementing this:

Option 1 – Using ContentProvider.openFile

This seems like an obvious choice for giving 3rd party applications the ability to read files from my ContentProvider. I think it starts getting tricky when those applications need to create or update files through my `ContentProvider’. I’ll need a callback when they are finished in order to know when to send the new/changed file back to the server. I believe I could use a FileObserver for that purpose though.

Option 2 – Using a Messenger through a Service

With this approach, I can send the files between my application and client applications through the Messenger. The files would have to be passed through a Bundle, so I am not sure what the best format is for transmitting them (File, FileDescriptor, byte array, something else??). I don’t have a good handle on whether or not this would cause problems if the files get to be large.

Option 3 – a hybrid approach

  1. Use folder(s) on external storage as a drop box
  2. Communicate CRUD requests, and drop box contents, through a Messenger/Service
  3. Use the ContentProvider to store the status of requests
  4. 3rd party app receives status updates through a ContentObserver

Summary

I think using ContentProvider would be the ideal solution, but it seems that the API does not fully support my use case. I am concerned that trying to go down that path might result in a kludgy implementation. If I go with a Messenger and Service approach, I am uncertain of the most robust way to transfer the files through a Bundle.

The hybrid approach seems pretty robust, but the most complex to implement. Files aren’t actually being passed around, so performance should be good. However, I fear this is over-architecting the solution.

What is the best approach for transferring files between applications running on the same Android device? Of course, I am open to other options which I have not outlined in my question.

  • 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-25T10:54:42+00:00Added an answer on May 25, 2026 at 10:54 am

    Content provider is definitely the way to go. If you consider that google uses this approach for almost everything then it becomes appaentr that this is the intended design method.

    I’m not extolling the virtues of them, but in the land of the blind, the one eyed content provider is king.

    Update

    There is an example of how to do this in CommonsWare book, see the link provided.

    Source of Content Provider/Files

    Use the synch framework for content providers. Simply maintain a list of requests and then schedule the sync to download those file. You can also do this on network tickles etc. you can use broadcast intents or contentobserver to notify clients that the file is downloaded.

    In essence this is probably similar to your 3rd option but importantly it uses the Android supplied tools rather than rolling your own.

    Ad Endum

    Best place to start is the android SDK sample in: android-sdk\samples\android-8\SampleSyncAdapter but be warned that there’s a load of contacts related stuff that masks the juicy bits. It took me a while to figure out that I could delete almost all of it except the syncadapter

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

Sidebar

Related Questions

I'm writing an Android application that needs to store dates and time into file
I'm writing an Android application that I want to be able to send requests
I'm writing an android application that draws directly to the canvas on the onDraw
I've followed this tutorial: http://anandhansubbiah.com/blog/writing-your-first-android-application/ , but no matter what I do, and what
I'm writing an android application that maintains a lot of state data...some of it
I'm writing an application that will ship in two versions: Android and PC version.
I'm writing an application that is compatible with Android 1.6, but I would like
I'm writing an application in PhoneGap that I want to run on iOS, Android,
I am writing an android application that has a webview. On the first load
I'm currently writing an Android application that should be able to receive push notifications

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.