Activity result from org.cyanogenmod.focal - android

I currently use this code to call the camera activity with a result which works fine.
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(getOutputMediaFile(stockT.getText().toString().toUpperCase())));
startActivityForResult(intent, 10);
I recently flashed latest cyanogenmod 10.2-20130915 and now I no longer have access to some of the stock camera features. I want to use org.cyanogenmod.focal to take the photos, since it supports so many features that I want and need.
Question
Is this possible to use a third party app like focal to return images as a result if so could you post some code to help me out?
Background (in case of another solution):
This app is used by me only. The app scans VINs and creates folder on the sdcard based on the stock number of the vehicle. I then use the camera intnet to take images and once returned the app shrinks them down to a specific size and jpg quality and saves them into their specific folder. Once I am finished with a set of vehicles I simply click a button and the adjusted images are uploaded to our server and pushed out to our vendors.

It turns out that the focal developers are going to actually include this activity. It is actually missing now so when the app is called it just opens like normal since it does not yet support this feature.

Related

image auto saves to device picture album

I have a multi platform app - iOS and Android.
One of the features in the app is to capture images. I have a toggle switch in the app settings which allows the user to save the image to the device picture album if the switch is enabled.
This is an issue I can only produce in Android. Even without the toggle switch enabled, the captured photos still save to the device. I have tested this on Android 4.4.2 and 6.0
It does not do this in iOS.
There is nothing in my code to suggest that the photo should still be saved, I have checked it over and over.
Has anyone else come across this? If so what can be done to rectify the issue?
Thanks,
This is simply how FireMonkey captures images on Android. It saves a captured image to a file before handing the pixel data to you. And it does not provide access to the captured image's filename so you can remove the file afterwards.
FireMonkey has an IFMXCameraService interface with a TakePhoto() method, which accepts a NeedSaveToAlbum option:
Taking Pictures Using FireMonkey Interfaces
However, it is currently broken on Android:
RSP-13118: [Android] TTakePhotoFromCameraAction saves Image on Disk unexpectedly
RSP-15820: IFMXCameraService TakePhoto , NeedSaveToAlbum False not working
Until that is fixed, you could use JNI to access Android's camera APIs directly, then you can do whatever you want with the images.

android camera intent stuck on confirmation

I'm using a chooser to allow the user to pick a photo from his gallery or take a new one using his camera (I copied the code from this answer).
Picking an image from the gallery works perfect. The problem is that when I capture an image with the camera It's not returning to the app and just stays in the confirmation screen...
I actually don't even need this screen to be displayed in the first place...
Can I somehow disable it or (if not) just make the Done button work?
Thanks in advance!
Can I somehow disable it
No.
just make the Done button work?
Contact the developers of your camera app, and point out the bug. Perhaps someday they will fix it.
You are using ACTION_IMAGE_CAPTURE. This launches a third-party camera app, to take a picture. There thousands of Android device models. These ship with hundreds of different pre-installed camera apps, and there are many more available for download from the Play Store and elsewhere. Any could be the one that handles a given ACTION_IMAGE_CAPTURE request, and any of them can have bugs.

Capture image in Android via intent (ACTION_IMAGE_CAPTURE)

Is there a "secure" way to invoke the android camera with the intent MediaStore.ACTION_IMAGE_CAPTURE to capture a picture?
I am using the following code to take a snapshot from the camera:
Uri tempFile = Uri.fromFile(tempFile()); // returns a temporary stored files that is "Context.MODE_WORLD_WRITEABLE" so that android can put the file in this location
// tempFile looks like: file:///data/data/com.example.myapp/files/temp_picture.jpg
Intent camera = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
camera.putExtra(MediaStore.EXTRA_OUTPUT, tempFile);
startActivityForResult(camera, Constants.REQUESTCODE_PICTURE_RESULT);
After that (returning from camera "RESULT_OK") I am copying the tempFile to the secured application store Context.MODE_PRIVATE and deleting the tempFile.
Everything works fine, the picture is taken and stored on the given Uri. But also the image is placed (in case of my current development device "HTC Sensation") in the galery
from my device (location is /mnt/sdcard/DCIM/100MEDIA/IMAG00XX.jpg). Why is the picture stored twice, I didn't even mention this location in my code? Is this a HTC "feature" or does the android camera store the file twice for media
scanning?
I also tried to get the Bitmap from the camera by omitting the MediaStore.EXTRA_OUTPUT parameter, but with this code I am only getting a thumbsize-picture from the camera (no full resolution).
I read a lot about the android camera, but I have to fetch an image from the camera in a "secured" way (no other app should read the data taken from the camera). I already
thought about implementing my own camera surface to catch a picture, but with this approach I must code a lot of stuff (flash, saturation, effects, zoom...) that the build in camera application already provides. Is it really that hard to take a picture on the android system?
If you want it to be 'secure', build camera functionality in your app. There is no way to be sure what some random camera app that comes pre-installed on a device does. They may be sending pictures to a server somewhere without you knowing. It's not super easy to do reliably, but you can only build the basic functionality. Failing that, require a specific app which you trust for image capture, by making the intent explicit (specify package name). This will, of course, require users to install it first if it is not already there.
I have implemented the camera in the same way as u have done. It creates the image and save it in the folder that i have created.but at the same time it saves image in the gallery as well. I have checked for this if other apps also does that or not. and found that even other apps does that and its not the issue of only HTC have tested it on various devices.even i am thinking how does it works.

Crop application availability in Android?

I have to crop an image. I'm using code similar to the one here. Which starts an activity which responds to this action:
"com.android.camera.action.CROP"
It works well on all devices I tested - it does find always 1 Activity and starts it. Works fine.
But can I rely on it? Or will be devices without any crop possibility (In that case I would have to implement the crop functionality in my App)?
Edit: Forgot to mention: Crop dynamically - the user will select the area (using a rectangle with fixed dimensions).
But can I rely on it?
No.
Or will be devices without any crop possibility
Yes. This has come up already. This is an undocumented, unsupported feature of one camera application that may or may not be present on the device, could be no longer exported in some future version of Android, etc.
In that case I would have to implement the crop functionality in my app
That is certainly what I would recommend. Note that there is a port of the crop activity from the Gallery app floating around GitHub somewhere that you could consider using, if you want the same basic functionality with your own private implementation.

Can you "wrap" the stock camera's functionality on a droid phone?

My company has a need to print a timestamp on images taken on a droid. Another developer mentioned that we could wrap the entire functionality of the stock camera, then once a photo is taken, embed the timestamp on it. Can this be done, and if so, how simple/complex would it be?
Pretty simple actually. Definitely way simpler then writing a camera app from scratch.
Here is a short overview to give you a few keywords:
You need to fire a ACTION_IMAGE_CAPTURE intent,
this launches the devices camera app and prompts the user to take a picture (stock app or not doesn't even matter). When the picture is taken it will return to your app¹. At this point you'll get a file URI of the taken image that points to a JPEG usually.
Once you have that, load the image via the BitmapFactory into a Bitmap object and edit it by using a Canvas. You can use Canvas.drawText() to draw the text. Then store it where you need it, send it off the device or do whatever you want with it. And that's all the magic.
¹ here is a small example how to do that, found via google, there are plenty more out there

Categories

Resources