contentprovider

Best practices for exposing multiple tables using content providers in Android

I'm building an app where I have a table for events and a table for venues. I want to be able to grant other applications access to this data. I have a few questions related to best practices for this kind of problem. How should I structure the database classes? I currently have classes for EventsDbAdapter and VenuesDbAdapter, which pr...

Android private content provider?

Hello, 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 that can do so; my hesitation is in making it secure. I want this data to be usabl...

ContentProvider Instantiation failure - NullPointerException

this is the code for my custom provider, mostly copied from the SDK notepad project i cant understand why am i getting nullPointException, why doesnt the provider instance get created? thanks ! :) RegistrationProvider.java package alon.beginner.registerform; import android.database.SQLException; import java.util.HashMap; import alon...

How can one inject the sqlite3 keyword DISTINCT into an Android ContentProvider's query?

I have a SQL statement that I can use to return distinct rows from my Android sqlite3 database and I would like to pass it through the ContentProvider's query. For example: select lastName from peopleTable where upper(lastName) like upper("%smith%"); needs to be select DISTINCT lastName from peopleTable where upper(lastName) like up...

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 that exposes the data to clients should actually contain a content: URI string. This...

How can i query the contacts content provider outside an activity?

I'm trying to query the Contacts content provider outside an Activity. But managedQuery is a method of Activity. Is there any other class/method that I can use instead of managedQuery? Here's my code: class MyActivity extends Activity { private Cursor getContacts() { Uri uri = ContactsContract.Contacts.CONTENT_URI; String[] projec...

Android ContentProvider Uri Matching

I am trying to create a content provider where the key contains forward slash "/". I searched about it for quite a while but there is no place/example illustrating it. content://com.lily.provider/items/* General example, which I understand: content://com.lily.provider/items/ab What I want to do: my key is a string with "/" content:/...

getContentResolver().openOutputStream(uri) No files supported by provider

I want store a file audio in my personal content provider. i save record: Uri uri = getContentResolver().insert(CONTENT_URI, values); OutputStream os = getContentResolver().openOutputStream(uri); but getContentResolver().openOutputStream(uri); throws: 10-13 19:44:53.903: ERROR/TAB(5679): No files supported by provider at content://co...

How can I tell a Content Provider where to store a file related to a record?

I understand, that I can use ContentResolver's "openOutputStream()" to get a writeable stream of a file that is automatically created for my record, if it contains a "_data" attribute. But I can't find any docs on exactly where this file will be created? Can I alter this location? I'd be better if the provider would create them on the S...

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 { private Context mContext; private ContentResolver mContentResolver; @Override ...

android bookmark ContentProvider makes bookmark but not visible in browser's bookmarks

I'm using Android's Browser Bookmark ContentProvider to create a new bookmark programatically. The bookmark is created (I can retrieve it programatically via the ContentProvider) but the bookmark isn't visible in the browser bookmark view. Thoughts? // Saving the bookmark via ContentProvider final ContentValues bookmarkValues = new Con...