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
1
vote
2 answers

How to pass binary data between two apps using Content Provider?

I need to pass some binary data between two android apps using Content Provider (sharedUserId is not an option). I would prefer not to pass the data (a savegame stored as a file, small in size < 20k) as a file (ie. overriding openFile()) since this…
Viktor
  • 3,295
  • 2
  • 25
  • 26
1
vote
0 answers

Failed to find provider info for

In the encoding process I encountered one of the following exceptions: 09-12 14:12:36.327 10764-10764/cn.com.luckytry.interview E/ActivityThread: Failed to find provider info for cn.com.luckytry.interview.service 09-12 14:12:36.327…
Vicent
  • 13
  • 2
1
vote
0 answers

Import whatsapp chat in a app

I would like to import whatsapp chats in my app; I try to use content provider but response is permission denied; This is my first app and this is the first time that I use content provider so I don't know if it is impossible to import chat or…
Teo
  • 11
  • 2
1
vote
0 answers

Cannot grant File Provider Permissions to com.android.mms

I am trying to send a bitmap from the cache directory of my app to another external application by granting temporary read permissions through a file provider. When I select the messaging application on my phone (package name : "com.android.mms")…
1
vote
1 answer

Difference between: getPathSegments().get(1) and / vs getLastPathSegment()

I've seen both being used for getting the ID in a content provider. String id = uri.getLastPathSegment(); String id = uri.getPathSegments().get(1); Is there a difference? and if so, is one better / better practice than the other? Or in which…
Halfacht
  • 924
  • 1
  • 12
  • 22
1
vote
0 answers

ContentProvider jUnit testing with dependencies to static method and other ContentProvider

I'm newbie writing unit tests for my Android app. Currently I'm testing ContentProviders (like here) and I recently finished one and all fine doing CRUD operations tests for a "satellite" SQLite table ("satellite"=no foreign keys). Now I have to…
1
vote
0 answers

Getting Cursor IndexOutOfBound Exception when passing contact-id to fetch details from Contacts

I am getting contact details of a person according to the account name which is working fine but i get the exception for those contacts which have name but not numbers. I am also getting the contact ids for those but when i fetch the details using…
1
vote
0 answers

Do you have to declare methods as synchronized in a ContentProvider to use SyncAdapter?

I am altering my application to start using SyncAdapter to sync with a server instead of my current implementation. I created a ContentProvider class (MyDB) which uses an SQLiteOpenHelper to create an SQLiteDatabase and handle basic crud operations…
Cruces
  • 3,029
  • 1
  • 26
  • 55
1
vote
0 answers

Use ContentObserver with BlockedNumberContract

I have a VOIP calling and texting app. I need to be able to monitor changes to the native blocked number list so I can maintain that list on my server. Following the documentation on BlockedNumberContract at…
1
vote
1 answer

How to make a FileProvider serve drawables?

The FileProvider documentation lists these locations as places where it can serve files from: the files/ subdirectory of an app's internal storage area the cache subdirectory of an app's internal storage area the root of the external storage…
albert c braun
  • 2,650
  • 1
  • 22
  • 32
1
vote
1 answer

What is the format for an android intent?

I'd like to know what is the format for an android intent. IE, what should I pass to the method : getBaseContext().startService(Intent); If I want to pass this: android.provider.CallLog.Calls.CONTENT_URI can i? What would be the format. Can…
rogcg
  • 10,451
  • 20
  • 91
  • 133
1
vote
0 answers

Using a CursorAdapter with two different ContentProviders

I would like to display a list of contacts. I would like to pull those contacts from Android's contacts ContentProvider (as defined by ContactsContract) as well as a table of contacts managed by my own app (for which I've also defined a…
1
vote
0 answers

Meaning full name from content provider

Trying to figure out how to get a meaning full name of an custom user related location through an content provider on the device for example an SD Card. In case of the emulator wanted to display "Virtual SD Card" instead of "BA11-150F". Letting the…
Jules
  • 189
  • 1
  • 5
  • 20
1
vote
0 answers

ContentProvider onCreate is called multiple times

I have an app which has a ContentProvider. The app listens for certain broadcast event. I have a service which uses the content provider. This service is started based on the broadcast event. Service runs in a separate process.Main application is…
digitizedx
  • 386
  • 5
  • 16
1
vote
1 answer

Android save image to file system

I have an activity that on start calls an intent to launch the camera app. The camera should take a photo, save to local system, and present it into an imageview. However when the photo is taken I get this message: E/BitmapFactory: Unable to decode…
QuasarLex
  • 75
  • 3
  • 11