android-contentprovider

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

天涯浪子 提交于 2019-11-26 20:11:24
问题 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

How to implement a ContentObserver for call logs

为君一笑 提交于 2019-11-26 19:53:49
I'd like to know if there is a way to know if the content provider of callings has changed. I mean, if I make a call, or I answer a call, it returns a "flag" that a new log has been added to the call log, or the place where Android store informations about callings. Because, when I make a call, Android stores the number, the contact name (if exists), the hour of the calling, the duration, ..., all in the content provider. So is there a way to capture this "flag" that says the content provider of callings is bigger, I mean, that a new data has been inserted on the content provider CallLog.Calls

Android error - close() was never explicitly called on database

微笑、不失礼 提交于 2019-11-26 19:46:39
Where should I call close() on the code? The LogCat returns this error: close() was never explicitly called on database android.database.sqlite.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here The error is this: > 12-16 17:24:50.886: ERROR/Database(10982): close() was never explicitly called on database '/data/data/com.psyhclo/databases/calls.db' 12-16 17:24:50.886: ERROR/Database(10982): android.database.sqlite.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here 12-16 17:24

When to use a Content Provider

不打扰是莪最后的温柔 提交于 2019-11-26 19:33:16
I understand that Content Providers are made to allow publicly sharing data between applications. However, I'm wondering if anyone has thoughts about making a Content Provider to use just within your own app. Would there be any advantages to doing this? Any disadvantages? In the past I've just implemented the SQliteOpenHelper to access data from my database, but I'm considering creating a Content Provider. I feel like the URI approach to requesting data is clear and concise. On the other hand, will using a Content Provider just for my application be redundant ( since within it I will have a

How to access the SMS storage on Android?

為{幸葍}努か 提交于 2019-11-26 19:11:59
问题 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

Android - Querying the SMS ContentProvider?

被刻印的时光 ゝ 提交于 2019-11-26 18:59:56
问题 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

Prevent network sync loop when syncing from network in Android ContentProvider

南楼画角 提交于 2019-11-26 18:59:52
问题 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,

android - CursorLoader & SQLite without Content Provider

六月ゝ 毕业季﹏ 提交于 2019-11-26 18:48:57
问题 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

Closing the database in a ContentProvider

谁说胖子不能爱 提交于 2019-11-26 18:23:51
This week I've been learning all about ContentProvider and using the SQLiteOpenHelper class to manage the creation and upgrading of the database inside of a provider. Specifically, I've been reading through the NotePad example from the sdk's samples directory. Now, I can see that SQLiteOpenHelper has a close() method. I'm aware that leaving idle databases open is bad practice and can cause memory leaks and whatnot (unless this discussion is headed in the right direction). If I were using the class in an Activity, then I would simply call close() in the onDestroy() method, but as far as I know,

Android - Having Provider authority in the app project

佐手、 提交于 2019-11-26 15:49:32
问题 An android library project contains a few providers whose authority is defined like the following in a contract class : public static final String CONTENT_AUTHORITY = "my.com.library.providers.tester"; private static final Uri BASE_CONTENT_URI = Uri.parse("content://" + CONTENT_AUTHORITY); Now there are a lot of app projects which uses this library project. The problem I am currently having is that for every app project, I need to have a separate branch in the library project for every app