android-contentprovider

Android - open pdf in external application

馋奶兔 提交于 2019-12-19 10:28:16
问题 i've a pdf file in my app assets directory that i want open using an external app, so wrote my content provider and i'm tryng to make it work but nothing... here is the code: Content Provider: package package.name; import java.io.File; import java.io.FileNotFoundException; import java.net.URI; import android.content.ContentProvider; import android.content.ContentValues; import android.database.Cursor; import android.net.Uri; import android.os.ParcelFileDescriptor; public class

Check Incoming number is stored in Contacts list or not android

余生长醉 提交于 2019-12-19 10:17:56
问题 In my android app when an incoming call i want to show my custom ui and i am able to do this. No i want to check incoming number is from contacts or not. Below is my code for doing so but it returns null for an incoming number which is stored in my contacts list. public String findNameByNumber(String num){ Uri uri = Uri.withAppendedPath(Phones.CONTENT_FILTER_URL, Uri.encode(num)); String name = null; Cursor cursor = mContext.getContentResolver().query(uri, new String[] { Phones.DISPLAY_NAME }

Android - Select max in contentProvider

帅比萌擦擦* 提交于 2019-12-19 08:17:36
问题 I try to run this query on my custom contentprovider. cursor = activity.getContentResolver().query( GoalDescriptor.CONTENT_URI, "max(priority)", null, null, null); to obtain the max value of priority int column. i tried also : cursor = activity.getContentResolver().query( GoalDescriptor.CONTENT_URI, null, "max(priority)", null, null); whit no success. This code return this exception: java.lang.IllegalArgumentException: Invalid column MAX(priority) E/DatabaseUtils( 688): at android.database

Requesting read permission from my own ContentProvider in another app

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-19 07:54:39
问题 In one app, I have the following content provider declared in my AndroidManifest: <provider android:name="com.example.MyProvider" android:label="@string/provider_name" android:authorities="com.example" android:readPermission="com.example.permission.READ" /> And another app requests permission to use it: <uses-permission android:name="com.example.permission.READ" /> But when run this code: ContentResolver resolver = this.context.getContentResolver(); Cursor results = resolver.query

differentiate inbox and sentsms from all sms

℡╲_俬逩灬. 提交于 2019-12-19 04:56:33
问题 I am working on an ANdroid application.In my app I have to list all the conversations and i did that part.Each conversation is containing all sms to that number. So i have to differtiate inbox and sentsms from all sms.I know about the following api's can use to find inbox and sent. content://sms/inbox content://sms/sent But i don't want to use this.I listed all sms by using the api content://sms/ I tested with the columnindex's type,address but it always gives the same result for inbox and

How to implement a ContentProvider for providing image to Gmail, Facebook, Evernote, etc

江枫思渺然 提交于 2019-12-19 02:59:35
问题 My previous question (Is it possible to share an image on Android via a data URL?) is related to this question. I have figured out how to share an image from my application to another application without having permission to write files to external storage. However, I do still get a number of problem behaviors: When I try to share the image from my phone (Android 2.2.2), fatal errors occur in the receiving applications, and they doesn't come up with the image at all. (Could this be a result

Android ContentProvider read and write permissions

泄露秘密 提交于 2019-12-19 02:39:09
问题 permissions don't seem to make any difference... In the manifest, I have only one <uses-permission> ( permission.INTERNET ), and I have two <permission> elements: <permission android:name="myapp.permission.READ" android:permissionGroup="myapp.permission-group.MYAPP_DATA" android:label="@string/perm_read" android:description="@string/perm_read_summary" android:protectionLevel="signature" /> <permission android:name="myapp.permission.WRITE" android:permissionGroup="myapp.permission-group.MYAPP

Fetch address from “canonical_addresses” table

允我心安 提交于 2019-12-19 02:07:10
问题 I am working on an Android application. I fetched recipient_id from the following uri. content://mms-sms/conversations?simple=true Now I want to fetch the address from canonical_addresses " table using the recipient id. But I don't have any idea to query canonical_addresses table" . I searched a lot in web. Please help me to find a solution friends. 回答1: Canonical table has two columns, _id and address . When you get recipient id you do a lookup for that id in the canonical addresses table.

How do implicit joined columns work with Android contacts data?

微笑、不失礼 提交于 2019-12-18 14:10:53
问题 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 =

How do implicit joined columns work with Android contacts data?

这一生的挚爱 提交于 2019-12-18 14:10:01
问题 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 =