android-contentprovider

hyphens are an issue in getting contact details with a partial phone number

依然范特西╮ 提交于 2019-12-11 11:16:22
问题 I have a function to get all contacts with part of a phone number, here... Cursor c = getContentResolver().query(Data.CONTENT_URI, new String[] {Data._ID, Phone.NUMBER}, Phone.NUMBER + " like ?", new String[] {"%"+String.valueOf(phoneNumber) +"%"}, null); while (c.moveToNext()) { String id = c.getString(0); String number = c.getString(1); Log.d("id",id); Log.d("number",number); } but the problem is - IF i insert 31221 I can't get contacts with a phone number like 312-2131-321 Because of "-"

ContentProvider Database not getting deleted

若如初见. 提交于 2019-12-11 09:54:51
问题 I'm developing a content provider which stores its data in an SQLite database. During development, I need to change the schema, or delete the database entirely and have it rebuilt (I'm not upgrading the database at this stage of development). I found the database file, stored at /data/data//databases/app_db . When I pull it to my desktop machine, I can use SqliteSpy to see its content and all is well. However, when I delete it, it doesn't always get really deleted. Although I can't see the

Android save or insert MMS in content provider programmatically

血红的双手。 提交于 2019-12-11 09:44:35
问题 I am trying code described below, I got it from internet. It inserts rows in content provider(mmssms.db) properly but MMS is not shown Native Messaging App. thread_id 11 is already present in my content provider so I am using thread_id 11. public static Uri insert(Context context, String to, String subject, byte[] imageBytes) { try { Uri destUri = Uri.parse("content://mms"); // Get thread id //Set<String> recipients = new HashSet<String>(); //recipients.addAll(Arrays.asList(to)); long thread

Notification/Event for row and column level observation in Content Provider

浪子不回头ぞ 提交于 2019-12-11 09:08:24
问题 I have content provider which has one Table. I would like to know when ever the table rows are modified. I am using Content Observer for the Table URI, which does tell when the table is modified. However it does not give much information about which row is modified, also which columns are modified. I am looking for something similar to iOS API "handleManagedObjectContextDidChangeNotification".Is there any Open source library or API available for row and column level observation? 回答1:

SQLite “database schema has changed” error in Content Provider

纵然是瞬间 提交于 2019-12-11 08:42:10
问题 I'm using Content Providers and Sync Adapters for my synchronization routine. My routine receives a JSONObject and insert or update the entry. In order to decide if we are going to update or insert we check if the entry exists in the database. This is where the sqlite error occurs. 06-03 10:58:21.239: INFO/Database(340): sqlite returned: error code = 17, msg = prepared statement aborts at 45: [SELECT * FROM table WHERE (id = ?) ORDER BY id] I have done some research and found this discussion

Android URL Scheme To Open File From Browser Link?

寵の児 提交于 2019-12-11 08:28:35
问题 On Android (8.0), I'm trying to create a local html file that includes links to some local files that can't be viewed directly by Chrome, like <a href="relative_path_to_file/file.docx"> . In a normal web browser (i.e. on a PC), I can click the link and it will open the file in its default viewer. On Android, if I open one of the local html files in Chrome and click one of those links, it directs me to content://nextapp.fx.FileProvider/path_to_file/file.docx, showing "Your file was not found."

Android Calendar Provider exception on recurring events

浪子不回头ぞ 提交于 2019-12-11 08:12:17
问题 I try to utilize the CalendarContract content provider: http://developer.android.com/reference/android/provider/CalendarContract.Events.html I only can't seem to find anything regarding exception on recurring events. I use the Instances URI to query. I added an event (on calendar.google.com) and made it repeat every day. Now I changed one of the instances' time and the content provider gives me the exception correctly: // Original event instance: eventID: 320 instanceID: 651 startdate: Wed

ContentProvider (contacts) - no such column: metadata_dirty

為{幸葍}努か 提交于 2019-12-11 06:54:08
问题 I'm trying to get all contacts of a specific type from the phone like following: Cursor cursor = context.getContentResolver().query( ContactsContract.RawContacts.CONTENT_URI, null, ContactsContract.RawContacts.ACCOUNT_TYPE + "='com.whatsapp'", null, ContactsContract.RawContacts.CONTACT_ID + " ASC"); But this line already throws an exception (custom rom, nougat => maybe it's related to this?). I only got this error from one user yet and I'm stuck here, does anyone know how to solve that? Is

Update Contact Data by Data ID

好久不见. 提交于 2019-12-11 06:46:39
问题 My application uses the Contacts ContentProvider to store some of its data. When I load a contact into memory, I want to save its ID (so that I know how to save changes later), and the ID of all data fields it is using (so they can be directly updated). Here is some of my code: Uri entityUri = Uri.withAppendedPath( ContentUris.withAppendedId(RawContacts.CONTENT_URI, id), Entity.CONTENT_DIRECTORY); Cursor resultData = context.getContentResolver().query( entityUri, new String[]{RawContacts

URI Matching on content provider not matching correctly

a 夏天 提交于 2019-12-11 06:38:11
问题 I've been trying now for a while but I can't seem to resolve my URI matching problem. Any help is greatly appreciated. Here is my declaration of the content uri and the uri matcher: private static final String AUTHORITY = "edu.uprm.civil.db"; public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY); private static UriMatcher sURIMatcher = new UriMatcher(UriMatcher.NO_MATCH); static { sURIMatcher.addURI(AUTHORITY, "/get-table" + "/*", TABLE_REQUEST_CODE); sURIMatcher.addURI