android-contentprovider

ContentObserver should call if and only if ContactsContract.Contacts.CONTENT_URI changes

*爱你&永不变心* 提交于 2019-11-29 06:15:27
As my application uses content from android.provider.ContactsContract.Data (API > 11) and ContactsContract.Contacts.CONTENT_URI (API < 11) to populate Contacts . I've tried to registerContentObserver() against these provider. But it calls my ContentObserver even if I tries to Call a person from device as soon as I put the call. It does trigger my ContentObserver which is not useful for me as there's no Content Change in Contacts Provider . Root Cause: Seems like LAST_TIME_CONTACTED or something in ContactsContract.Contacts.CONTENT_URI do changes when a call has been made from device which

Accessing custom content provider from different app

不想你离开。 提交于 2019-11-29 05:56:00
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 " Failed to find provider info for com.example.customcp. I have declared my content provider in the manifest file of the first app as <provider android:name="com.example.CustomCP" android:authorities="com.example.customcp"/> I try to call the provider in the second's application start up activity public class app2 extends Activity { @Override public

Make exception event from original recurring event?

好久不见. 提交于 2019-11-29 05:12:17
I found that Events.CONTENT_EXCEPTION_URI ( here ) used for make recurring event. It's hardly to find document or code example from internet. So I try many ways 1 Insert as SyncAdapter ContentValues values = new ContentValues(); values.put(Events.ORIGINAL_INSTANCE_TIME, CaldavGlobalVar.getCurrentTime_()); values.put(Events.SELF_ATTENDEE_STATUS, status); if(!username.equals("")){ values.put(Events.ORGANIZER, username); } if(event.getSummarry()!=null){ values.put(Events.TITLE, event.getSummarry()); } if(event.getDescription()!=null){ values.put(Events.DESCRIPTION, event.getDescription()); } if

How to show more providers with ACTION_OPEN_DOCUMENT

风格不统一 提交于 2019-11-29 03:50:59
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 Intent(Intent.ACTION_OPEN_DOCUMENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("application/pdf"); startActivityForResult(intent, EDIT_REQUEST); and then handle the returned URI in onActivityResult() . The problem is that, in the resulting menu, I get far less content providers than I expected. Only Google Drive and Downloads (see left screen shot below). Others, like Dropbox, Solid Explorer,... are not show. I suspect the reason is that

Own ContentProvider with SQLite and multiple tables

孤者浪人 提交于 2019-11-29 03:49:42
问题 I am reading this tutorial on implementing my own ContentProvide for working with SQLite. Int the ContentProvider.query there are a few thing that puzzles me. It seems very hardcoded to just one table (the todo table in the tutorial), but maybe Im just not getting it? Now if I wanted to query another table, lets say nodo, how would I change the ContentProvider? Should I append the table names somehow in queryBuilder.setTables(String inTables)? What about the CONTENT_TYPE and CONTENT_ITEM_TYPE

how to decide between direct database access and content provider?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-29 02:56:13
问题 I am writing an application that consists of business logic and UI parts. There is quite big amount of data to be stored and accessed/modified by both BL and UI. In most of the cases changes to the stored data should be reflected by UI immediately. How do I decide whether I should or should not use direct DB access? content provider? I have done some reading on the subject (1, 2) and I understand the difference between these two options. Please share your thoughts on other aspects of the

Listen to android calendar changes. (Sync/Delete/Insert etc..)

与世无争的帅哥 提交于 2019-11-29 02:52:27
问题 I've understand I have to use Content Provider to get all changes, but I also realized starting API14 there is a ready Content Provider for the calendar which I can use to listen to instead of "building" my own custom one. Is there anywhere I can see an example of this ? Can someone please post the core of this listener ? Thanks 回答1: First you need to add this type of receiver to the Manifest: <receiver android:name="your.package.name.CatchChangesReceiver" android:priority="1000" > <intent

How do I catch content provider initialize?

孤街醉人 提交于 2019-11-29 02:36:51
问题 As we know content provider loads on application run. But I want to make some operations before content provider will launch. How do I catch this operation? Before content provider's onCreate method would be called 回答1: I think Ive found solution. Ive created my custom application class and overridden attachBaseContext method <application android:name=".ApplicationController" ...> public class ApplicationController extends Application { @Override protected void attachBaseContext(Context base)

Possible to use multiple authorities with FileProvider?

瘦欲@ 提交于 2019-11-29 01:01:23
Background I maintain a library whose core functionality involves sharing programmatically-captured screenshots to external email applications. I use a FileProvider to accomplish this, which means my library's manifest contains a <provider> tag : <provider android:name="android.support.v4.content.FileProvider" android:authorities="${applicationId}.bugshaker.fileprovider" android:exported="false" android:grantUriPermissions="true"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/filepaths" /> </provider> filepaths.xml is defined as follows: <paths> <files

Android Permission denial in Widget RemoteViewsFactory for Content

橙三吉。 提交于 2019-11-28 23:29:18
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 list in the onDataSetChanged method. the app crashes with the following message: 11-01 16:40:39.540: E/ACRA(27175): DataDisplay fatal error : Permission Denial: reading com.datadisplay.content.ContentProviderAdapter uri content://com.datadisplay.provider.internalDB/events from pid=573, uid=10029 requires the provider be exported, or