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
14
votes
2 answers

ContentProvider destruction/lifecycle

I'm curious if someone can explain the lifecycle of a ContentProvider. I'm especially interested in if, when and under what circumstances a provider is destroyed. That doesn't appear to be covered by the documentation. The ContentProvider section…
spaaarky21
  • 6,524
  • 7
  • 52
  • 65
14
votes
1 answer

What is a replacement of deprecated MODE_WORLD_READABLE SharedPreferences in Android?

I am developing Android app A so that another one B could read A's SharedPreferences. In javadoc for android.content.Context the following is said about both MODE_WORLD_READABLE and MODE_WORLD_WRITEABLE: This constant was deprecated in API level…
14
votes
3 answers

Android Permission denial in Widget RemoteViewsFactory for Content

I have a widget which I am trying to use to display information from my app's local database inside of a listview. I'm using the RemoteViewsService.RemoteViewsFactory interface to load my list's contents. If I run the block of code which reloads the…
13
votes
2 answers

Providing icon to system chooser via ChooserTargetService, FileProvider and grantUriPermission

I have some images stored in local app connected with certain contexts (like contacts). I'm using direct share (API 23+) via ChooserTargetService to show these to choose from and I want to ChooserTarget instances to have Icon filled with these…
13
votes
2 answers

Android camera intent FileUriExposedException for SDK >= 24

I use this code to get a picture from camera and put it on imageview: private void openCamera() { mMediaUri =getOutputMediaFileUri(MEDIA_TYPE_IMAGE); Intent photoIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); …
ste9206
  • 1,822
  • 4
  • 31
  • 47
13
votes
3 answers

How to store large blobs in an android content provider?

I have some large files (images and video) which I need to store in a content provider. The android documentation indicates... If you are exposing byte data that's too big to put in the table itself — such as a large bitmap file — the field…
13
votes
3 answers

How would a thread created by an app be considered a different app from the app's ContentProvider?

I have an app that, when notified by a ContentObserver of a change to a ContentProvider, attempts to query the provider on a background thread. This causes an SecurityException to be thrown: 8-10 15:54:29.577 …
Julian A.
  • 10,928
  • 16
  • 67
  • 107
13
votes
2 answers

Conflicting content providers facebook SDK

I have a problem with facebook SDK version 4.0.0 -> I am trying to set up two different flavors of my app - staging and production. Everything works as fine as expected but I get INSTALL_FAILED_CONFLICTING_PROVIDER error when trying to install one…
13
votes
2 answers

How to show more providers with ACTION_OPEN_DOCUMENT

I want to use the android system dialog provided as part of the Storage Access Framework to open a file. I do this with Intent intent = new…
cgogolin
  • 960
  • 1
  • 10
  • 22
13
votes
2 answers

How to fix content provider url not found in android Content provider?

I have followed the below tutorial http://www.vogella.de/articles/AndroidSQLite/article.htm But getting this exception after clicking on "confirm" button 01-20 10:18:14.585: E/AndroidRuntime(2006): Caused by: java.lang.IllegalArgumentException:…
venu
  • 2,971
  • 6
  • 40
  • 59
13
votes
3 answers

How to share data across a group of applications in Android

Consider the following scenario. A company releases many apps. And they want some data to be shared across all these apps. Any of these app can create or read these data, just like a common database. So company decided to create an android library…
13
votes
4 answers

Insert Contact (ContactsContract) via Intent with Image (Photo)

There is many Q&A threads, but none of them is providing real answer, or I couldn't find it. To ensure you, I've searched before asking: Android: set contact photo with ContactsContract insert intent (invalid answer) Insert contact in Android with…
13
votes
2 answers

Android: Extending user's contact book. Performance ContentProvider vs Sqlite vs List in memory

Me and my Android team have a problem. We have an app that present the user's contact book, with extended information. Current setup Our app reads the Contacts Provider of the Android OS. Sends this information to our Server that calculates a couple…
13
votes
2 answers

Android get sms from inbox, optimized way to read all messages and group them

Hi am implementing a SMS App, now am able to retrieve all messages with their respective contact info like display name, photo uri.. and am displaying them in a custom list where on item click takes you to respective discussion. Here my issues is…
13
votes
1 answer

can we get chrome browsing history/bookmarks in our android app

can we get chrome browsing history/bookmarks like we get in default browser using READ_HISTORY_BOOKMARKS permission? PS:I Just want to know is it possible?