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
20
votes
1 answer

How to observe contentprovider change? android

I'v created a Contentprovide and implements it's update() method like this: @Override public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) { final SQLiteDatabase db = mHelper.getWritableDatabase(); int…
herbertD
  • 10,657
  • 13
  • 50
  • 77
19
votes
4 answers

Failed to find Content Provider in API 30

UPDATE: I have to completely change my question since I found more details related to my problem. The problem: My app that resolves Content Provider doesn't work in Emulator with API 30. The error: java.lang.SecurityException: Failed to find…
StahlRat
  • 1,199
  • 13
  • 25
19
votes
6 answers

Accessing custom content provider from different app

Hello i have created an android app that uses a custom content provider named CustomCP, it implements all methods and everything works fine while managing data inside the app, but when i try to access it from another app i keep getting an error of "…
tgAndroid
  • 191
  • 1
  • 1
  • 3
19
votes
4 answers

Problems with Android's UriMatcher

In an answer to a previous question of mine someone indicated that there is some flakiness (for lack of a better word) inherent in the Android class UriMatcher. Can anyone pinpoint the known issues with UriMatcher? I'm designing a Content Provider…
Lunchbox
  • 2,136
  • 7
  • 29
  • 40
19
votes
2 answers

Android private content provider?

I am developing an application that involves some sensitive user information. I retrieve this information via a private web API. I am trying to determine the best way to get this data into my app. Right now I'm exploring creating a content provider…
Allyn
  • 20,271
  • 16
  • 57
  • 68
19
votes
11 answers

How to check database on not rooted android device

I am developing an app where i am using sqllite3 database to store values. I have Nexus S and Nexus 7 both are unrooted devices. How can i get the database for my app for debugging purpose. I have tried (1) I have tried all approach mentioned…
CodingRat
  • 1,934
  • 3
  • 23
  • 43
19
votes
2 answers

Exported content providers can provide access to potentially sensitive data

I'm using ContentProvider in my android application to share the database between the application. For sharing the database I need to add the provider access in AndroidManifest.xml like as…
Rajesh Rajaram
  • 3,271
  • 4
  • 29
  • 48
19
votes
4 answers

Specifying limit / offset for ContentProvider queries

I'm trying to get my ContentResolver to run this query: select * from myTable limit 1 offset 2 The only query method in ContentResolver is: resolver.query(uri, projection, selection, selectionArgs, sortOrder); I've tried: final Cursor c =…
Buffalo
  • 3,861
  • 8
  • 44
  • 69
19
votes
3 answers

Do I need a Content Provider with a Cursor Loader?

I am having trouble working out how to use a CursorLoader. The problem I am trying to solve is how to display data from my SQLite database in a ListActivity. The list rows use a custom layout so need data from 3 fields (all in the same table). Along…
John
  • 1,466
  • 3
  • 21
  • 38
19
votes
4 answers

Android Content provider list

Where can I get the full list of Content Provider that Android offers out of the box? Specifically, I'm looking for a content provider that lists received SMS.
systempuntoout
  • 71,966
  • 47
  • 171
  • 241
18
votes
2 answers

Widget with content provider; impossible to use ReadPermission?

So I've just implemented a widget for my app. It gets its data from the database through my ContentProvider. I define my own read/write-permissions in my manifest, state that I use them (doesn't seem to make a difference), and require them in the…
Jonas Kalderstam
  • 1,136
  • 12
  • 27
18
votes
3 answers

Group By in ContentResolver in Ice Cream Sandwich

I am making a query on the Android Contacts ContentProvider. I need a Group By clause. In Gingerbread and Honeycomb, I do something like this to search phone numbers and emails at the same time: (The actual WHERE clause is much more complicated as…
njzk2
  • 38,969
  • 7
  • 69
  • 107
18
votes
3 answers

Cursor wrapping/unwrapping in ContentProvider

I'm creating ContentProvider which is a proxy of another ContentProvider (for security issues and to give access to part of functionality of full app). public class GFContactsProvider extends ContactsProvider implements DatabaseConstants { …
ViviQ
  • 193
  • 1
  • 6
18
votes
4 answers

Android: Bulk Insert, when InsertHelper is deprecated

There is plenty answers and tutorials using InsertHelper to do fast bulk insert in SQLiteDatabase. But InsertHelper is deprecated as of API 17. What is now the fastest method to bulk insert large sets of data in Android SQLite ? So far my greatest…
Marek Sebera
  • 39,650
  • 37
  • 158
  • 244
17
votes
3 answers

Is it possible to access resources in another APK without using content providers?

I thought that it is impossible to access resources contained in other APK unless content providers are used. However, I stumbled upon an app called Better Keyboard. It uses skins, so I decided to download an example of a skin. An example skin…
Malcolm
  • 41,014
  • 11
  • 68
  • 91