android-contentprovider

INSTALL_FAILED_CONFLICTING_PROVIDER in Android

若如初见. 提交于 2019-11-30 14:40:23
问题 I am using an open-srouce code from Google for an app called MyTracks. I am getting this error when the original app is installed on the phone. INSTALL_FAILED_CONFLICTING_PROVIDER I know that this is because of the android:authorities in the Manifest. here is the part of the Manifest: <provider android:name="com.google.android.apps.mytracks.content.MyTracksProvider" android:authorities="com.google.android.maps.mytracks" android:exported="true" android:readPermission="com.google.android.apps

Database handling with 2 processes

坚强是说给别人听的谎言 提交于 2019-11-30 14:34:56
问题 I have a an application that has 2 parts. A service which creates content. An application that uses the content Each of these run as different processes. The problem is that both of them share a database. And I frequently get database locked error, both when the service tries to write something and the UI is reading data. Also vice versa. How do go about this? The class used to access DB is a singleton class. But since both UI & the service are 2 different processes, there are 2 singletons I

Android Contentprovider - update within an insert method

邮差的信 提交于 2019-11-30 12:17:46
Is it ok to call the SQLiteDatabase update method in the insert() overridden method of a content provider? Basically it's fine, but since you didn't provided code, I just can post 2 possible ways for it First: // In your content provider public Uri insert(...) { long insertId = db.insert(...); if(insertId == -1) { // insert failed, do update db.update(...); } } Second: public Uri insert(...) { long insertId = db.insertWithOnConflict(table, null, values, SQLiteDatabase.CONFLICT_REPLACE) if(insertId == -1) { // insert and update/replace failed } } Check out SQLiteDatabase for reference on the

How to fix content provider url not found in android Content provider?

倖福魔咒の 提交于 2019-11-30 11:57:36
I have followed the below tutorial http://www.vogella.de/articles/AndroidSQLite/article.htm But getting this exception after clicking on "confirm" button 01-20 10:18:14.585: E/AndroidRuntime(2006): Caused by: java.lang.IllegalArgumentException: Unknown URL content://com.example.todos.contentprovider/todos 01-20 10:18:14.585: E/AndroidRuntime(2006): at android.content.ContentResolver.insert(ContentResolver.java:910) 01-20 10:18:14.585: E/AndroidRuntime(2006): at com.example.todos.TodoDetailActivity.saveState(TodoDetailActivity.java:122) 01-20 10:18:14.585: E/AndroidRuntime(2006): at com.example

Write sent sms to content://sms/sent table

混江龙づ霸主 提交于 2019-11-30 11:37:35
问题 I am working on an android sms application.I can send sms to single contact by using the following code. sms.sendTextMessage(phoneNumber, null, message, sentPI, deliveredPI); Now I want to send sms to multicontacts.Some suggest to use loop.SO now I am using loops to send sms to multicontact. After sending each sms I write those values to sent table. ContentValues values = new ContentValues(); values.put("address", mobNo); values.put("body", msg); getContentResolver().insert(Uri.parse("content

INSTALL_FAILED_CONFLICTING_PROVIDER in Android

て烟熏妆下的殇ゞ 提交于 2019-11-30 11:21:06
I am using an open-srouce code from Google for an app called MyTracks. I am getting this error when the original app is installed on the phone. INSTALL_FAILED_CONFLICTING_PROVIDER I know that this is because of the android:authorities in the Manifest. here is the part of the Manifest: <provider android:name="com.google.android.apps.mytracks.content.MyTracksProvider" android:authorities="com.google.android.maps.mytracks" android:exported="true" android:readPermission="com.google.android.apps.mytracks.READ_TRACK_DATA" android:writePermission="com.google.android.apps.mytracks.WRITE_TRACK_DATA" />

How do implicit joined columns work with Android contacts data?

笑着哭i 提交于 2019-11-30 11:05:29
I'm querying the ContactsContract.Data table to find phone records. I get an error when I create a new CursorLoader : java.lang.IllegalArgumentException: Invalid column deleted My code: import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.ContactsContract.Data; ... String[] projection = { Phone.DELETED, Phone.LOOKUP_KEY, Phone.NUMBER, Phone.TYPE, Phone.LABEL, Data.MIMETYPE, Data.DISPLAY_NAME_PRIMARY }; // "mimetype = ? AND deleted = ?" String selection = Data.MIMETYPE + " = ? AND " Phone.DELETED + " = ?"; String[] args = {Phone.CONTENT_ITEM_TYPE, "0"}; return

Database handling with 2 processes

馋奶兔 提交于 2019-11-30 11:00:20
I have a an application that has 2 parts. A service which creates content. An application that uses the content Each of these run as different processes. The problem is that both of them share a database. And I frequently get database locked error, both when the service tries to write something and the UI is reading data. Also vice versa. How do go about this? The class used to access DB is a singleton class. But since both UI & the service are 2 different processes, there are 2 singletons I presume. So that doesn't help. Even synchronise won't help I suppose, since again because of 2

Returning a memory mapped InputStream from a content provider?

自闭症网瘾萝莉.ら 提交于 2019-11-30 09:55:19
The the client side of a content provider consumer I can do something like this, to get a proper InputStream for reading the picture: InputStream is = getContentResolver().openInputStream(pictureUri); It is a nice API, and will on the server side, the actual content provider result in a call to: public ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundException { // Open a proper ParcelFileDescriptor, most likely using openFileHelper(uri, mode) } But what if the picture mapped to the URI is not to be found on the filesystem, but as a memory resource, or generated on the

Link Android application with contacts/phonebook programmatically

风格不统一 提交于 2019-11-30 09:39:29
I'm currently writing an App which allows to extend the standart Android contacts / phonebook. The user can add some informations / content associated with a specific contact. I want the standart phonebook to show an link to my application on every contact which has additional data in my application. For example WhatsApp is able to do so. If somebody from you phonebook has an WhatsApp account the phonebook displays a small WhatsApp icon next to the contact. If you hit the icon WhatsApp starts automatically a chat with this specific person. My question is now how this can be achieved ? If