Questions tagged [android-contentprovider]

Content providers are one of the primary building blocks of Android applications, providing content to applications.

Content providers are one of the primary building blocks of Android applications, providing content to applications. They encapsulate data and provide it to applications through the single ContentResolver interface. A content provider is only required if you need to share data between multiple applications.

For example, the contacts data is used by multiple applications and must be stored in a content provider. If you don't need to share data amongst multiple applications you can use a database directly via SQLiteDatabase

For more information about using content providers, read the Content Provider's documentation.

3206 questions
22
votes
1 answer

Master-detail Using ContentResolver.applyBatch()?

I was wondering if its possible to save master and detail records to a content provider using the android.content.ContentResolver.applyBatch() method in the same operation where subsequent ContentProviderOperation items in the providers parameter…
Dan
  • 791
  • 7
  • 11
22
votes
4 answers

Android Facebook content provider authority

I'm developing an app with (at least) two flavors having different package names - therefore actually two different apps as far as the android system is concerned. The app uses Facebook sharing, so I have the provider declared in the…
nasch
  • 5,330
  • 6
  • 31
  • 52
22
votes
1 answer

Android Contacts provider get only phone contacts with all emails

I need to get all phone contacts and their email address and photo uri: This is what am doing: private void getContacts() { ContentResolver cr = getContentResolver(); Cursor cur = cr.query(Contacts.CONTENT_URI, null, null, null,…
22
votes
1 answer

Is it a good practice to use rawQuery in ContentProvider?

I am using my custom ContentProvider to communicate with sqlite database. I would like to display on a list (using ListFragment), data that comes from two tables (with many to many relation). The only solution I can think of for such case is to use…
Piotr Gorajski
  • 396
  • 2
  • 10
22
votes
1 answer

How does CursorLoader with LoaderManager know to send the cursor to a CursorAdapter?

I was going through some of my code and I realized I don't actually know how a CursorLoader and LoaderManager combination used with a CursorAdapter connect. Heres the part that I am confused in. agendaAdapter = new MyAgendaAdapter(this,…
21
votes
2 answers

How to handle RESTful update of remote server with SyncAdapter

I've watched the Google I/O REST talk and read the slides: http://www.google.com/events/io/2010/sessions/developing-RESTful-android-apps.html I'm still a bit unclear on how to nicely handle, say, an update error thrown by the remote server. I have…
21
votes
1 answer

I am getting IllegalArgumentException during picking a document file from download manager ,which is happening only for oreo

Here I am attaching the logs : Caused by: java.lang.IllegalArgumentException: Unknown URI: content://downloads/public_downloads/1587 at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:165) at…
21
votes
2 answers

Android: How to get a content:// URI for a file in the external storage PUBLIC directory

I've followed this Google tutorial to start an intent to capture an image with new Intent(MediaStore.ACTION_IMAGE_CAPTURE). The tutorial recommends using the public directory with getExternalStoragePublicDirectory which would work great for my app.…
Paul
  • 1,907
  • 2
  • 21
  • 29
20
votes
2 answers

Using @string for android:authorities in a ContentProvider

I have a ContentProvider in my manifest, when I define them fully with hardcoded strings it works. E.g. Works perfect, however the ContentProviders are in a library that…
HaMMeReD
  • 2,440
  • 22
  • 29
20
votes
2 answers

How to restrict content provider data across applications

How can we ensure that certain applications are not able to access my data stored in content provider where in certain other applications can access that? Basically I need to allow some application of my interest to access my data stored in Content…
Kaps
  • 2,345
  • 2
  • 26
  • 37
20
votes
5 answers

Permission denied : opening provider com.google.android.apps.photos.contentprovider.MediaContentProvider that is not exported from uid

My app is crashing only in android >= 6.0 (marshmallow) when I try to access a photo URI stored previously in SharedPreferences. Though the image is retrieved for the first time without any error. I am using targetSdkVersion 22 so that I don't need…
20
votes
1 answer

How do implicit joined columns work with Android contacts data?

I'm querying the ContactsContract.Data table to find phone records. I get an error when I create a new CursorLoader: java.lang.IllegalArgumentException: Invalid column deleted My code: import…
20
votes
4 answers

Recyclerview + Content provider + CursorLoader

I have some data in SQLite database.I have a content provider which will get the data from the database. Now the problem is how do i implement cursorLoader to work in hand with recyclerview? Also, anyone can explain why we need to transfer the data…
20
votes
2 answers

Custom ContentProvider - openInputStream(), openOutputStream()

The content provider/ resolver APIs provide a complicated, but robust way of transferring data between processes using a URI and the openInputStream() and openOutputStream() methods. Custom content providers have the ability to override the…
hannasm
  • 1,951
  • 4
  • 16
  • 25
20
votes
10 answers

INSTALL_FAILED_CONFLICTING_PROVIDER in Android

I am using an open-srouce code from Google for an app called MyTracks. I am getting this error when the original app is installed on the phone. INSTALL_FAILED_CONFLICTING_PROVIDER I know that this is because of the android:authorities in the…
ghostrider
  • 5,131
  • 14
  • 72
  • 120