Questions tagged [android-contentresolver]

A ContentResolver represents the connection between an app requesting data and the target ContentProvider.

A ContentResolver represents the connection between an app requesting data and the target ContentProvider. A typical way to access the ContentResolver is through the getContentResolver() method of an Activity.

1031 questions
24
votes
1 answer

Inserting a video into MediaStore

I'm trying to insert a video into the MediaStore, the same way it's possible to store an image using this method: MediaStore.Images.Media.insertImage(getContentResolver(), imagePath, null, null) Since there's no similar method on…
Juan Andrés Diana
  • 2,215
  • 3
  • 25
  • 36
23
votes
1 answer

Media scanner for secondary storage on Android Q

With the newer Android Q many things changed, especially with scoped storage and gradual deprecation of file:/// URIs. The problem is the lack of documentation on how to handle media files correctly on Android Q devices. I have a media file (audio)…
23
votes
2 answers

How does getContentResolver() work?

I watched a course about ContentProvider on the Internet demonstrating how to define and use a ContentProvider. I was confused about using the method named getContentResolver(). What does this method return? My ContentProvider is not instanced and…
krosshj
  • 855
  • 2
  • 11
  • 25
22
votes
1 answer

Android Contacts provider get only phone contacts with all emails

I need to get all phone contacts and their email address and photo uri: This is what am doing: private void getContacts() { ContentResolver cr = getContentResolver(); Cursor cur = cr.query(Contacts.CONTENT_URI, null, null, null,…
21
votes
3 answers

Can I perform this Android query with ContentResolver.query()? (LEFT JOIN and CASE)

I am looking to perform the following query (in pseudo-code) on Android: SELECT C.ID, C.NAME, CASE ISNULL(G.GROUPID,0) = 0 THEN 0 ELSE 1 END INGROUP FROM CONTACTS C LEFT JOIN GROUPMEMBERSHIP G ON G.CONTACTID = C.ID AND G.GROUPID = ? I am looking…
eidylon
  • 7,068
  • 20
  • 75
  • 118
20
votes
1 answer

I want to get whatsApp profilepicture but only getting name and contactnumber?

I want to get WhatsApp profile picture and number but using contentResolver I will getting only name and number using following snippet code. private void showContactWhatsApp(){ ContentResolver cr = getContentResolver(); Cursor…
Hiren Vaghela
  • 916
  • 1
  • 9
  • 22
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
18
votes
2 answers

Get real path from Uri - DATA is deprecated in android Q

I'm successfully implementing a method for retrieving the real path of an image from gallery by the Uri returned from ACTION_PICK intent. Here's a sample: // getRealPathFromURI(intent.getData()); private String getRealPathFromURI(Uri contentURI) { …
ronginat
  • 1,910
  • 1
  • 12
  • 23
17
votes
5 answers

Display the Contacts in sorting order ContactsContract.Contacts of Content Resolver

My intention is to display the contacts in sorting order using content resolver in android. For that I'm writing: Cursor pCur = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, …
user1862773
  • 173
  • 1
  • 1
  • 5
17
votes
1 answer

How to address multiple content providers?

I created two content providers that work on two different tables of the same SQLite database. They share a single instance of SQLiteOpenHelper as described in the post of Ali Serghini. Each content provider is registered in AndroidManifest.xml as…
JJD
  • 50,076
  • 60
  • 203
  • 339
16
votes
2 answers

When ContentResolver.notifyChange() is called for a given URI, are ContentObservers observing descendent URIs of this URI notified?

A hopefully straightforward question: When ContentResolver.notifyChange() is called for a given URI, are ContentObservers observing descendent URIs of this URI notified? E.g. Say I have a cursor setup to observer the URI of a specific resource: Uri…
16
votes
2 answers

registerContentObserver() on raw SQLite Cursor

All of the examples I've seen of using registerContentObserver() do so through a ContentProvider interface. But Cursor has a registerContentObserver() call, so I figured maybe the Android folks have put together some deep magic that would allow for…
mikerowehl
  • 2,222
  • 1
  • 17
  • 20
16
votes
2 answers

Using mp4parser , how can I handle videos that are taken from Uri and ContentResolver?

Background We want to let the user choose a video from any app, and then trim a video to be of max of 5 seconds. The problem For getting a Uri to be selected, we got it working fine (solution available here) . As for the trimming itself, we…
android developer
  • 114,585
  • 152
  • 739
  • 1,270
14
votes
1 answer

List all camera images in Android

How do you get a list of all camera images of an Android device? Is it through the MediaStore? How?
hpique
  • 119,096
  • 131
  • 338
  • 476
14
votes
2 answers

How does Content Provider's application specify permissions that client apps need in order to access the provider's data?

BACKGROUND I am reading this tutorial on Android Content Providers. I understand from this tutorial that, In order for other applications to access a Content Provider's data, the provider application must specify the permissions which the client…
1
2
3
68 69