android-contentprovider

How to store large blobs in an android content provider?

无人久伴 提交于 2019-11-27 04:00:58
I have some large files (images and video) which I need to store in a content provider. The android documentation indicates... If you are exposing byte data that's too big to put in the table itself — such as a large bitmap file — the field that exposes the data to clients should actually contain a content: URI string. This is the field that gives clients access to the data file. The record should also have another field, named "_data" that lists the exact file path on the device for that file. This field is not intended to be read by the client, but by the ContentResolver. The client will

Multiple Apps use same content provider

廉价感情. 提交于 2019-11-27 03:58:24
问题 I am developing a set of apps that are distinguished only in certain brandings (think different sports teams); however, I am running into a problem where I am using one Library project for all of the specifically branded apps and want to use the same ContentProvider for all of them. When I created the ContentProvider I declared the AUTHORITY as a constant in the class (per the dev example code) and I am using the same authority in every specific app in the manifest files. It looks like I can

can we get chrome browsing history/bookmarks in our android app

廉价感情. 提交于 2019-11-27 03:36:29
can we get chrome browsing history/bookmarks like we get in default browser using READ_HISTORY_BOOKMARKS permission? PS:I Just want to know is it possible? Yes it is very much possible. Use this uri: content://com.android.chrome.browser/bookmarks instead of Browser.BOOKMARKS_URI String[] proj = new String[] { Browser.BookmarkColumns.TITLE,Browser.BookmarkColumns.URL }; Uri uriCustom = Uri.parse("content://com.android.chrome.browser/bookmarks"); String sel = Browser.BookmarkColumns.BOOKMARK + " = 0"; // 0 = history, 1 = bookmark Cursor mCur = getContentResolver().query(uriCustom, proj, sel,

Multiple Apps use same content provider

回眸只為那壹抹淺笑 提交于 2019-11-27 03:20:41
I am developing a set of apps that are distinguished only in certain brandings (think different sports teams); however, I am running into a problem where I am using one Library project for all of the specifically branded apps and want to use the same ContentProvider for all of them. When I created the ContentProvider I declared the AUTHORITY as a constant in the class (per the dev example code) and I am using the same authority in every specific app in the manifest files. It looks like I can't use the same authority across every app as I get this error when trying to install a second app (I

Cursor.getType() for API Level <11

那年仲夏 提交于 2019-11-27 03:05:19
问题 I'm querying the CallLog content provider and need to detect the column types. In Honeycomb and newer (API Level 11+) you can get a columns preferred data type by calling the method Cursor.getType(int columnIndex) which returns one of the following types: FIELD_TYPE_NULL (0) FIELD_TYPE_INTEGER (1) FIELD_TYPE_FLOAT (2) FIELD_TYPE_STRING (3) FIELD_TYPE_BLOB (4) How can I accomplish this on pre-Honeycomb <11 devices? I've tried the following: for ( int i = 0; i < cursor.getColumnCount(); i++ ) {

Download image from new Google+ (plus) Photos Application

北慕城南 提交于 2019-11-27 02:03:23
问题 Recently Google added the Photos app for Google+ (plus) and it shows up when you launch an Intent to choose an image. However, if I select an image from Google+ Photos and try to use it in my application none of my current logic is able to return a usable URI or URL to actually get an image that I can download and manipulate. I'm currently using the "common" methods to try to manipulate the URI that can be found here on Stack Overflow and elsewhere. I can provide code if needed, but at this

How to restrict content provider data across applications

纵然是瞬间 提交于 2019-11-27 01:58:47
How can we ensure that certain applications are not able to access my data stored in content provider where in certain other applications can access that? Basically I need to allow some application of my interest to access my data stored in Content Provider but I do not want all the applications to be able to access that data. How can I achieve this? Thanks. The easiest way is to protect the content provider with a permission you define. Make it a signature a permission so only apps signed with your certificate are allowed to get it. See: http://developer.android.com/guide/topics/security

How to Copy Image File from Gallery to another folder programmatically in Android

时间秒杀一切 提交于 2019-11-27 01:20:46
问题 I want to pick image from gallery and copy it in to other folder in SDCard. Code to Pick Image from Gallery Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); photoPickerIntent.setType("image/*"); startActivityForResult(photoPickerIntent, REQUEST_CODE_CHOOSE_PICTURE_FROM_GALLARY); I get content://media/external/images/media/681 this URI onActivityResult. I want to copy the image, Form path ="content://media/external/images/media/681 To path = "file:///mnt/sdcard/sharedresources/ this

get the last picture taken by user

拜拜、爱过 提交于 2019-11-27 01:12:47
hey I want to get the last picture captured by user through any camera application. I have no idea how to do that can any one help me? further I want to send that image as an attachment to an email or MMS.. thanks Jessitron // Find the last picture String[] projection = new String[]{ MediaStore.Images.ImageColumns._ID, MediaStore.Images.ImageColumns.DATA, MediaStore.Images.ImageColumns.BUCKET_DISPLAY_NAME, MediaStore.Images.ImageColumns.DATE_TAKEN, MediaStore.Images.ImageColumns.MIME_TYPE }; final Cursor cursor = getContext().getContentResolver() .query(MediaStore.Images.Media.EXTERNAL_CONTENT

What is cursor.setNotificationUri() used for?

半世苍凉 提交于 2019-11-27 00:55:57
问题 I did research on how to use ContentProviders and Loaders from this tutorial How I see it: We have an Activity with ListView , SimpleCursorAdapter and CursorLoader . We also implement ContentProvider . In an Activity we can call getContentResolver().insert(URI, contentValues); via a button click. In our implementation of ContentProvider , at the end of insert() method, we call getContentResolver().notifyChange(URI, null); and our CursorLoader will receive message that it should reload data