android-contentprovider

How to grant temporary access to custom content provider using FLAG_GRANT_READ_URI_PERMISSION

99封情书 提交于 2019-11-30 09:16:13
I am trying to query custom content provider(App A) from another app(App B). I can do that when there is no permission protection for content provider. Specifically, I build custom content provider on App A and sent an intent containing the URI to App B. Here is intent-sending part in App A. class InsertOnClickListener implements OnClickListener{ public void onClick(View v) { ContentValues values = new ContentValues(); values.put(DataBaseConfiguation.TableConfiguation.USER_NAME, "Jack"); Uri uri = getContentResolver().insert(DataBaseConfiguation.TableConfiguation.CONTENT_URI, values); System

SecurityException: Permission Denial error

久未见 提交于 2019-11-30 09:11:50
问题 I've just upgraded to the new version of gmail (v2.3.5) and I've got an app that queries the content provider to get details about the contacts that messages are received for...... With the latest version I'm getting the below error: java.lang.SecurityException: Permission Denial: opening provider com.google.android.gm.provider.MailProvider from ProcessRecord{40adef58 3576:com.rageconsulting.android.lightflow/10056} (pid=3576, uid=10056) requires com.google.android.gm.permission.READ_GMAIL or

Android Facebook content provider authority

为君一笑 提交于 2019-11-30 08:16:52
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 manifest: <provider android:authorities="com.facebook.app.FacebookContentProvider{app id here}" android:name="com.facebook.FacebookContentProvider" android:exported="true"/> This is done according to Facebook's instructions: https://developers.facebook.com/docs/sharing/android This works fine with one app, but trying to install the second app on the same device

Accessing custom content provider from different app

本秂侑毒 提交于 2019-11-30 07:56:43
问题 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

Trouble writing internal memory android

可紊 提交于 2019-11-30 07:35:00
void launchImageCapture(Activity context) { Uri imageFileUri = context.getContentResolver() .insert(Media.INTERNAL_CONTENT_URI, new ContentValues()); m_queue.add(imageFileUri); Intent i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); i.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, imageFileUri); context.startActivityForResult(i, ImportActivity.CAMERA_REQUEST); } The above code, which has always worked, is now generating this exception for me at insert(). java.lang.UnsupportedOperationException: Writing to internal storage is not supported. at com.android.providers.media

How to get all contacts first name, last name, email, phone number, etc without duplicates

元气小坏坏 提交于 2019-11-30 06:38:51
问题 I am trying to get details of all the contacts available in phone contacts using below code. But facing small issue of duplicate values. EDITED ACTUAL CODE STARTS :- private String refreshData() { String emaildata = ""; try { ContentResolver cr = getBaseContext().getContentResolver(); String selection = ContactsContract.Contacts.IN_VISIBLE_GROUP + " = '" + ("1") + "'"; String sortOrder = ContactsContract.Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC"; Cursor cur = cr .query(ContactsContract

Content Observer onChange method called twice after 1 change in cursor

主宰稳场 提交于 2019-11-30 06:38:05
I have an app in which I am hoping to send details in the android contact list to a remote server, so that the user can see his contacts online. To do this I want to notify the remote server of any changes made on the phone to the contacts list. I have set up a ContentObserver on the 'ContactsContract.Contacts.CONTENT_URI' from a service that gets started when the phone is booted. I have a number of quiestions, the first 2 are incidental, the third is my major concern. 1: Once I have set up a service that registers a ContentObserver on my Cursor, does that observer only exist within the

Create asynchronous ContentProvider for Actionbar SearchView

♀尐吖头ヾ 提交于 2019-11-30 05:28:47
问题 I have a SearchView in my ActionBar which is connected with a ContentProvider to give search suggestions. These suggestions do not come from a DB (as usual with ContentProvider), but from a web service. That's why I have to handle the Cursor of the ContentProvider asyncronously. My code works so far, but the search suggestions are always one letter "behind": After I enter "the" , I get all results from the previous search => "th" After I enter "they" , I get all results from the previous

Own ContentProvider with SQLite and multiple tables

时光怂恿深爱的人放手 提交于 2019-11-30 05:18:40
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, should there be one for each table? That about the TODO and TODO_ID varibles and the switch in the

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

試著忘記壹切 提交于 2019-11-30 05:18:39
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 First you need to add this type of receiver to the Manifest: <receiver android:name="your.package.name.CatchChangesReceiver" android:priority="1000" > <intent-filter> <action android:name="android.intent.action.PROVIDER_CHANGED" /> <data android:scheme="content" />