I have an Android app and I want to access the Camera from one of the activities. Besides, I want to store the photo inside the application internal directory (data/data/package...). However the camera doesn't have the permission to write in this directory. I don't want to use my own implementation of camera because I had some issues with that in the past. So I was wondering if there was any way to provide the camera with the permission it needs. I saw some way to do this by using ContentResolver/ContentProvider but I want to make it simpler.
Thus, I was wondering if using PendingIntent to call the camera instead of a classic Intent could do the work. Is it possible? Could you show me some code snippet to do that?
Here is my current code to call the camera:
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE"); File file = new File(Environment.getExternalStorageDirectory()+File.separator + "my_image.jpg"); intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file)); startActivityForResult(intent, CAPTURE_REQUEST_CODE);
Aucun commentaire:
Enregistrer un commentaire