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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T19:45:07+00:00 2026-05-16T19:45:07+00:00

I need third party applications (Foo) to get information from my application (Bar), but

  • 0

I need third party applications (“Foo”) to get information from my application (“Bar”), but my solution so far seems cumbersome:

  • Application Foo needs information from Bar and sends a broadcast (“bar.POLL”).
  • Application Bar listens for this broadcast, and replies with another broadcast (“bar.PUSH”);
  • Foo listens for bar.PUSH and reads the contents of the included Bundle.

Is there a more direct way to do this?

EDIT: I solved it with an extremely simplistic ContentProvider as Guido suggested:

public class MyProvider extends ContentProvider {
  private String state = "";

  @Override
  public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
    MatrixCursor cursor = new MatrixCursor(new String[]{"state"});
    cursor.addRow(new Object[]{state});
    return cursor;
  }

  @Override
  public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
    state = (String) values.get("state");
    return 1;
  }

  @Override
  public boolean onCreate() {
    return true;
  }

  @Override
  public String getType(Uri uri) {
    return null;
  }

  @Override
  public Uri insert(Uri uri, ContentValues values) {
    return null;
  }

  @Override
  public int delete(Uri uri, String selection, String[] selectionArgs) {
    return 0;
  }    
}

Remember to add the provider to the manifest:

<provider android:name=".MyProvider" android:authorities="com.example.hello" />

Update the state from an Activity like this:

ContentValues cv = new ContentValues();
cv.put("state", "myNewState");
getContext().getContentResolver().update(Uri.parse("content://com.example.hello"), cv, null, null);

Get content from the provider in the external app:

Cursor cur = managedQuery(Uri.parse("content://com.example.hello"), null, null, null, null);
if (cur.moveToFirst()) {
  String myContent = cur.getString(0);
}
  • 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-16T19:45:08+00:00Added an answer on May 16, 2026 at 7:45 pm

    You should expose a ContentProvider.

    “Content providers store and retrieve data and make it accessible to all applications. They’re the only way to share data across applications; there’s no common storage area that all Android packages can access.“

    Content providers implement a common interface for querying the provider and returning results. It is not hard to implement, but maybe the official documentation is not the best to get started with it. You can find other examples at:

    • http://thinkandroid.wordpress.com/2010/01/13/writing-your-own-contentprovider/
    • google
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My application depends on another third-party framework and I need to make sure the
I have a third party .NET Assembly and a large Java application. I need
I need to modify the following MySQL statement to include information from a third
I have a third-party app that creates HTML-based reports that I need to display.
I need to access some members marked internal that are declared in a third
We need to PGP encrypt files and send them over FTP to a third
Need a function that takes a character as a parameter and returns true if
Need a way to allow sorting except for last item with in a list.
Need to an expression that returns only things with an I followed by either
Need to locate the following pattern: The letter I followed by a space then

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.