android-contentprovider

ContentProvider not called onCreate after deleting database

点点圈 提交于 2019-12-11 06:16:05
问题 I have created ContentProvider which creates one Database on application launching. Now In that application, I am doing process of deleting database when user logout from app. After that when I come again to login, the ContentProvider cant call onCreate() of overrided class. Is there any way to recreate database using ContentProvider? 回答1: I found solution as, First of all I referred Refresh/Reload database reference in custom ContentProvider after restore but not satisfied with answer

Getting all contacts timestamp wise

£可爱£侵袭症+ 提交于 2019-12-11 05:25:41
问题 I have been trying to get all contacts of device sorted by the order they were added. I am using following query: Uri uri = ContactsContract.CommonDataKinds.Phone.CONTENT_URI; String[] projection = new String[] { ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME, ContactsContract.CommonDataKinds.Phone.NUMBER, ContactsContract.CommonDataKinds.Phone.CONTACT_STATUS_TIMESTAMP }; Cursor c = getContentResolver().query(uri, projection, null, null, ContactsContract.CommonDataKinds.Phone.CONTACT

Android ContentObserver never stopped

雨燕双飞 提交于 2019-12-11 04:22:42
问题 I implemented a ContentObserver and it worked fine. But now everytime the ContentObserver is notified for some changes in the CallLog.Calls content provider, it runs the onChange() method without stopping. I'd like that my observer runs once for each item that has changed in the content provider. So, if 5 new items have been added to the CallLog.Calls content provider, the observer must be notified 5 times, and for each notify to the observer, a new call to the onChange() method must happen.

Downloaded SQLite database and leak warnings

独自空忆成欢 提交于 2019-12-11 04:15:12
问题 I've made an application that uses a downloaded SQLite database. To retrieve data in it I'm using a ContentProvider . When I need to read the database, I always (I've checked at least five times) use a code like this: Cursor c = getContext().getContentResolver().query(MyContentProvider.ITEMSURI, projection,where,null,null); if(c.moveToFirst()){ while(!c.isAfterLast()){ itemsList.add(cursorToItem(c)); c.moveToNext(); } } if(c!=null) c.close(); But I keep getting many errors like this (I make a

Android content provider protection level & different keys

三世轮回 提交于 2019-12-11 03:37:06
问题 I have an app available in Pro (paid) & Free (add supported) versions. Both versions are signed with the same key store, but each one with its own key alias. Know, I'd like to develop a plugin compatible with both versions, offering data through a content provider. The data is sensitive, so I need my content provider to be accessible only from my app (both Pro & Free versions). Using a permission with the android:protectionLevel="signature" is not working, because the Free & Pro versions do

Failed sending messages storage android

混江龙づ霸主 提交于 2019-12-11 03:18:46
问题 Just want to ask where does the default android messaging app stores and read failed to send messages. I thought it can be queried on content://sms/sent with STATUS_FAILED as status. Thanks. 回答1: Telephony.Sms.Outbox . This class will help you retreive messages which were not sent due to some reason. use URI as content://sms/failed for retrieving failed sent messages. Similarly other types can be retrieved as : Inbox = "content://sms/inbox" Failed = "content://sms/failed" Queued = "content:/

Adding new contact with photo via ContactsContract and ContentProvider

好久不见. 提交于 2019-12-11 03:08:12
问题 I've been trying all day to add contact with photo to Android Contacts. Finally I'm adding picture to contact, but I can't add any name or phone number. Contact is displaying as "(Unknown)", with proper photo. My code: private void addContact2() { final String displayName = "XYZA"; final String mobileNumber = "666666"; final byte[] photoByteArray; // initalized elsewhere ArrayList<ContentProviderOperation> ops = new ArrayList<>(); ops.add(ContentProviderOperation.newInsert(ContactsContract

Update Activity data from service when its paused

六月ゝ 毕业季﹏ 提交于 2019-12-11 03:07:38
问题 Lets say I have an activity that has a data object. It updates its gui component based on that object. Now lets say that it is paused ( OnPause is called) but not stopped or destoryed Meanwhile , a push notification is received ( intentservice is started) and I need to update that object with the push notification object so I gui is updated when the app is resumed. I thought about sending a broadcast to the activity so it can update its dataobject But I read somewhere that when activity is

How to get notify which SMS got read from native(phone) if multiple unread SMS are present in phone(native)?

雨燕双飞 提交于 2019-12-11 02:54:56
问题 If 3 unread SMS messages are present in native(phone), and user has read one of the SMS. How to identify which SMS got read(from native) in our application. Currently I am using ContentObserver and onChange() method is called when user read SMS from native(phone). I am able to get all unread SMS messages: Cursor cursor = this.getContentResolver().query(Uri.parse("content://sms/"), null, "read = 0", null, null); How to identify which SMS got read from native(phone). Any help or guidance will

Android CalendarContract, deleting a recurring event causes all events to disappear on calendar?

守給你的承諾、 提交于 2019-12-11 02:46:09
问题 I have a sync adapter that handles syncing calendars and events. I am able to delete normal events just fine. But whenever I delete a recurring event, all the events on my calendar disappear. One thing I noticed is that whenever I deleted a recurring event, the Instances table is emptied, which explains the events disappearing. The Events table is as expected, with the recurring event row deleted from the table. What is causing this? I have tried deleting in the following ways: resolver