android-contentprovider

How to get camera result as a uri in data folder?

假如想象 提交于 2019-11-26 10:15:49
I am creating an application in which I want to capture a image and then I want to send that image in the email as a attachment. I am opening a camera using android.provider.MediaStore.ACTION_IMAGE_CAPTURE intent action and I am passing the Uri of the file as a parameter EXTRA_OUTPUT to get the image back to the file. This is working perfectly and I am able to get the captured image if I use the external storage uri as a EXTRA_OUTPUT but if I use the data folder uri it is not working and the camera is not closing and its all buttons are not working. Here is my code for get the result in the

How to restrict content provider data across applications

主宰稳场 提交于 2019-11-26 09:48:20
问题 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. 回答1: The easiest way is to protect the content provider with a permission you define. Make it a signature a permission so only apps

Using build types in Gradle to run same app that uses ContentProvider on one device

我与影子孤独终老i 提交于 2019-11-26 09:04:47
问题 I have set up Gradle to add package name suffix to my debug app so I could have release version that I\'m using and debug version on one phone. I was referencing this: http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Types My build.gradle file looks like this: ... android { ... buildTypes { debug { packageNameSuffix \".debug\" versionNameSuffix \" debug\" } } } Everything works fine until I start using a ContentProvider in my app. I get: Failure [INSTALL_FAILED

Android error - close() was never explicitly called on database

心不动则不痛 提交于 2019-11-26 08:59:29
问题 Where should I call close() on the code? The LogCat returns this error: close() was never explicitly called on database android.database.sqlite.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here The error is this: > 12-16 17:24:50.886: ERROR/Database(10982): close() was never explicitly called on database \'/data/data/com.psyhclo/databases/calls.db\' 12-16 17:24:50.886: ERROR/Database(10982): android.database.sqlite

How to implement a ContentObserver for call logs

喜欢而已 提交于 2019-11-26 07:28:43
问题 I\'d like to know if there is a way to know if the content provider of callings has changed. I mean, if I make a call, or I answer a call, it returns a \"flag\" that a new log has been added to the call log, or the place where Android store informations about callings. Because, when I make a call, Android stores the number, the contact name (if exists), the hour of the calling, the duration, ..., all in the content provider. So is there a way to capture this \"flag\" that says the content

When to use a Content Provider

狂风中的少年 提交于 2019-11-26 06:59:35
问题 I understand that Content Providers are made to allow publicly sharing data between applications. However, I\'m wondering if anyone has thoughts about making a Content Provider to use just within your own app. Would there be any advantages to doing this? Any disadvantages? In the past I\'ve just implemented the SQliteOpenHelper to access data from my database, but I\'m considering creating a Content Provider. I feel like the URI approach to requesting data is clear and concise. On the other

Closing the database in a ContentProvider

我怕爱的太早我们不能终老 提交于 2019-11-26 06:17:44
问题 This week I\'ve been learning all about ContentProvider and using the SQLiteOpenHelper class to manage the creation and upgrading of the database inside of a provider. Specifically, I\'ve been reading through the NotePad example from the sdk\'s samples directory. Now, I can see that SQLiteOpenHelper has a close() method. I\'m aware that leaving idle databases open is bad practice and can cause memory leaks and whatnot (unless this discussion is headed in the right direction). If I were using

Android KitKat (API 19) - How to write messages in SMS Content Provider, without sending them, from Non-Default App?

怎甘沉沦 提交于 2019-11-26 04:48:27
问题 I am trying to create an Android app that writes messages in the Sent Box of the system. These messages should not be sent over the GSM network to the recipient, the idea is only to write them in the Sent Content Provider. For now, I have this code: Manifest File <uses-permission android:name=\"android.permission.READ_SMS\"/> <uses-permission android:name=\"android.permission.WRITE_SMS\"/> Java Class private final String SENT_SMS_CONTENT_PROVIDER_URI_OLDER_API_19 = \"content://sms/sent\";

Create and Share a File from Internal Storage

落花浮王杯 提交于 2019-11-26 04:24:34
问题 My goal is to create a XML file on internal storage and then send it through the share Intent. I\'m able to create a XML file using this code FileOutputStream outputStream = context.openFileOutput(fileName, Context.MODE_WORLD_READABLE); PrintStream printStream = new PrintStream(outputStream); String xml = this.writeXml(); // get XML here printStream.println(xml); printStream.close(); I\'m stuck trying to retrieve a Uri to the output file in order to share it. I first tried to access the file

How to get camera result as a uri in data folder?

江枫思渺然 提交于 2019-11-26 02:06:18
问题 I am creating an application in which I want to capture a image and then I want to send that image in the email as a attachment. I am opening a camera using android.provider.MediaStore.ACTION_IMAGE_CAPTURE intent action and I am passing the Uri of the file as a parameter EXTRA_OUTPUT to get the image back to the file. This is working perfectly and I am able to get the captured image if I use the external storage uri as a EXTRA_OUTPUT but if I use the data folder uri it is not working and the