android-contentprovider

Using data from context providers or requesting Google Photos read permission?

大城市里の小女人 提交于 2019-11-27 20:07:28
My app allows users to import their photos and videos from other apps. Now that Google replaced Google+ Photos with Google Photos, couple of things broke for me. One of these things is re-using imported files after app restart. I have a feeling they've tightened up the permissions given out when Google Photos returns the intent with the image URI, so after my app gets killed it no longer has the permission to access the uploaded file. I'm getting the Security expection: java.lang.SecurityException: Permission Denial: opening provider com.google.android.apps.photos.contentprovider

How does CursorLoader with LoaderManager know to send the cursor to a CursorAdapter?

放肆的年华 提交于 2019-11-27 19:13:30
问题 I was going through some of my code and I realized I don't actually know how a CursorLoader and LoaderManager combination used with a CursorAdapter connect. Heres the part that I am confused in. agendaAdapter = new MyAgendaAdapter(this, null); makeProviderBundle(new String[] {"_id", "event_name", "start_date", "start_time", "end_date", "end_time", "location"}, "date(?) >= start_date and date(?) <= end_date", new String[]{getChosenDate(), getChosenDate()}, null); getLoaderManager().initLoader

Content Provider INSTALL_FAILED_CONFLICTING_PROVIDER (installing content provider as a separate apk)

倖福魔咒の 提交于 2019-11-27 18:44:17
I have two applications which use the same content provider, but I can't put the same content provider in both applications- it shows INSTALL_FAILED_CONFLICTING_PROVIDER error. So I have put my content provider in a 3rd .apk and used this from two applications and it is working well. Now the problem is- The content provider apk must be installed before any of those two apps can be installed on the device. Otherwise, it shows Provider not found error during installation. So, how can I ensure that the provider apk is installed before any of the other apks is installed? Is there a way to merge

How to show more providers with ACTION_OPEN_DOCUMENT

徘徊边缘 提交于 2019-11-27 17:51:19
问题 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

How to access the SMS storage on Android?

拟墨画扇 提交于 2019-11-27 17:50:54
Beginner Android dev here. I'm trying to create an app that will read the SMS messages stored on the device and then give the user statistics about their habits (like who they message often, common words, etc). But to my knowledge, there doesn't seem to be a way to do this. I've looked around on forums and the most anyone talks about is accessing the inbox where you can find messages the user hasn't read. How then can the default app and third-party (Handcent for example) display the same texts? They don't keep their own database because Handcent will display all texts upon fresh install. tl

Android - Querying the SMS ContentProvider?

喜夏-厌秋 提交于 2019-11-27 17:28:23
I currently register a content observer on the following URI "content://sms/" to listen out for incoming and outgoing messages being sent. This seems to work ok and I have also tried deleting from the sms database but I can only delete an entire thread from the following URI "content://sms/conversations/" Here is the code I use for that String url = "content://sms/"; Uri uri = Uri.parse(url); getContentResolver().registerContentObserver(uri, true, new MyContentObserver(handler)); } class MyContentObserver extends ContentObserver { public MyContentObserver(Handler handler) { super(handler); }

Prevent network sync loop when syncing from network in Android ContentProvider

戏子无情 提交于 2019-11-27 17:28:20
I'm writing my own ContentProvider which will be synced to a web service using a SyncAdapter. Problem happens when the sync adapter is modifying the content provider's data the provider triggers a network sync when internally calling getContentResolver().notifyChange causing a sync loop. The notifyChange with the network sync flag is required for when a client application does the modification but should be avoided when the sync adapter is modifying. How can one, inside a contentprovider, easly tell if it's being used by a client application (which should trigger network sync upon modification

Exact Difference between “Content-Provider” and “SQLite Database”

有些话、适合烂在心里 提交于 2019-11-27 16:59:22
i have done SQLite database programming for Android, but i dont know anything about Content-Provider except this: "As i have referred Android Developer page , Android SDK explained about "Content-provider" as it is used to store and retrieve data." But then, What is the exact difference between "Content-Provider" and "SQLite Database"? Which is best to store data, when ? Any example or helps !! Paresh Mayani I found one major difference, as follows: Storing your data in a database is one good way to persist your data , but there's a caveat in Android-databases created in Android are visible

android - CursorLoader & SQLite without Content Provider

Deadly 提交于 2019-11-27 16:58:13
I know this has been discussed yet I wanted to ask about the current state of the matter. Do i have to create a ContentProvider to use CursorLoader in connection with a sqlite database? I found CursorLoader usage without ContentProvider Looks exactly what I was hoping for yet as Emmby commented Users should be aware of one limitation, which is that it has no mechanism to refresh on data changes (as Loaders are supposed to do) So another solution is mentioned https://github.com/commonsguy/cwac-loaderex yet again some drawback is pointed out However, to make use of the automatic re-querying, you

Best practices for exposing multiple tables using content providers in Android

本小妞迷上赌 提交于 2019-11-27 16:38:42
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 provide the logic for querying each table, while having a separate DbManager (extends SQLiteOpenHelper) for managing database versions, creating/upgrading databases, giving access to database (getWriteable/ReadeableDatabase). Is this the recommended solution, or