I'm developing an app that reads the metadata of images from a device.
One of the conditions is to have activated the geolocation for the photos of your camera to retrieve latitude/longitude from images.
Is it possible to send user (via Intent or something else) to the Camera settings/preferences directly?
I know it's possible to send user to general settings
Intent intent = new Intent(Settings.ACTION_SETTINGS);
startActivity(intent);
But I'm looking for a way to send it directly to the camera settings.
Is it possible to send user (via Intent or something else) to the Camera settings/preferences directly?
No.
I mean the "standard" Camera application of the device. In system settings usually exists a list of your apps and one of them is the Camera application.
No. There are ~2 billion Android devices, comprising thousands of device models. Those ship with hundreds of pre-installed camera apps, let alone the additional camera apps that users might install.
And, of note:
None of those camera apps have to have any sort of settings/preferences screen
None of those camera apps have to offer geolocation
Related
I have a requirement to develop an application which will monitor the usage of the phone cameras and record information about when/where a photo was taken. I am aware that this information is typically recorded in the image metadata but I have a need to add additional information to this and record it separately from the image.
In essence, I would like to know:
Any time the camera is opened, closed, activated (brought to front), deactivated (user switches to another app)
Any time the camera saes a file; either a photo or a video
Know the above regardless of whether the camera was launched directly or via another app
Know the above regardless of whether the caller used an intent or the camera APIs.
Are there good APIs to use for this? Is it possible to replace low-level interfaces to act as a man-in-the-middle? Is it possible from Java or would this necessarily be in C/C++?
At the moment my only solution would be to monitor the logs in a continuous service to identify everything I could from the above and implement a FileObserver to check for file creation/modification times.
Are there good APIs to use for this?
There are no APIs for this, for obvious privacy and security reasons.
Is it possible to replace low-level interfaces to act as a man-in-the-middle?
On a rooted device, perhaps. In a custom ROM, definitely. In an ordinary Android device, no, for obvious privacy and security reasons.
would be to monitor the logs in a continuous service to identify everything I could from the above
You have no access to logs, other than those generated by your own process, on Android 4.1+, except on rooted devices or from a custom ROM.
and implement a FileObserver to check for file creation/modification times
There is no requirement for a camera app to store a file in a place for which you have filesystem access.
it's possible to disable/remove this photo confirmation dialog:
I need somehow skip this dialog but I still want use an Intent. I found this android: Take camera picture without "save" / "delete" confirmation but I don't want use SurfaceView .
I need somehow skip this dialog but I still want use an Intent.
That is not possible.
There are over 8,000 26,000 Android device models. Across them, there are hundreds of different pre-installed camera apps. Additionally, there are hundreds of additional camera apps that users can install from the Play Store or elsewhere. Any one of them could respond to your ACTION_IMAGE_CAPTURE request.
The protocol for ACTION_IMAGE_CAPTURE does not have an option for "do not show any sort of confirmation dialog". Some camera apps will have such a dialog, others will not. A few apps might have some undocumented Intent extra for controlling that behavior, but most will not.
Either:
Live with the confirmation prompt, where it exists, or
Do not delegate this work to a third-party app, but instead use the camera APIs to take a picture yourself (the SurfaceView approach that you rejected, though it does not necessarily need SurfaceView), or
Do not write the app
Use "android.intent.extra.quickCapture" in Intent.
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra("android.intent.extra.quickCapture",true);
Per the Google Android camera tutorial I'm using:
new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
or
new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
to open the camera in my app.
Unfortunately, this forces the user to decide beforehand and prevents the user from toggling between pic & vid modes.
My problem is I want the user to go directly to the camera, be able to toggle between picture & video mode,
and then save the image/video accordingly.
Is there some way to:
1) read the Intent data in onActivityResult() and
2) ascertain (AFTER the image has been saved, NOT before) whether it's a pic or a video,
then
3) rename the image to ".jpg" or ".mp4" accordingly?
I've noticed that when I use
new Intent(MediaStore.INTENT_ACTION_VIDEO_CAMERA);
that the camera can then toggle between pic & vid.
But then it won't programmatically save the file.
I want the user to go directly to the camera, be able to toggle between picture & video mode, and then save the image/video accordingly.
That is not going to be possible in general, for the simple reason that you are asking other apps to take pictures and videos on your behalf. The protocol that Android has established for doing that is via the Intent actions that you are presently using. There is no ACTION_CAPTURE_SOMETHING_THAT_THE_USER_THINKS_IS_COOL or the equivalent that allows you to express that you want the user to make a choice after starting the third-party camera activity.
I've noticed that when I use new Intent(MediaStore.INTENT_ACTION_VIDEO_CAMERA);
that the camera can then toggle between pic & vid.
Only for the couple of camera apps that you have tried, out of thousands (pre-installed by device manufacturers, downloaded by users from the Play Store, etc.). The documentation certainly would not imply that behavior would be expected of all camera apps.
Is it possible to receive an intent each time the user take a picture with the device camera?
No, sorry. You can use a FileObserver to monitor the standard photo directory on the device, but that assumes that the app that the user is using is storing photos there.
i'm trying to port my android application to windows. in android, there is a way to start an activity with the ACTION_SEND flag i.e.
Intent intent = new Intent(android.content.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(android.content.Intent.EXTRA_TEXT, "....");
startActivity(Intent.createChooser(intent, "Subject"))
when you do this, a list of applications (i.e. facebook, text messaging, twitter, evernote, etc...) that can receive the passed in information is presented. the user selects one and information can be shared thus.
is there something analogous in windows phone 7?
Yes, Windows Phone 7 does have something similar. Take a look at Launchers and Choosers.
With launchers, you can launch another application but you do not get any information back from the newly launched application after it ends. This is similar to startActivity in Android. With choosers, you can receive information back, similar to startActivityForResults. There are a bunch of launchers and choosers available.
Windows Phone 7 currenlty includes no publicly available direct equivalent to Androids Intents.
To access system data and to perform certain actions that are built into the core of the OS and require user interaction, it uses Launchers and Choosers which can seem similar. It is not possible to create your own ones though.
If you want to add functionality like sharing to Twitter, etc. you'll need to add this functionality to your application.