I am trying to create an app that automatically uploads a picture to my server. The idea is that a user creates a picture with the native/normal camera and my app gets a notification (catches the event) and uploads the picture (in the background).
I found a solution for Windows Phone (see here), but not for Android. How can I do this? - Is this technically even possible (with the given APIs) or is it a special feature just for contracted services (Facebook or Dropbox do that)?
Thank you!
Right now i don't believe there is a Broadcast that is fired for a camera capture event that other activities can listen to.
But here's what you can do.
Declare an intent filter for "android.intent.action.CAMERA_BUTTON" and provide it the highest priority - 999
This will give you a handle on the broadcast fired by the native camera. However this would steal the broadcast from the native app. So you might have to handle saving the file yourself, or formulate a hack to give back control to the native app.
Don't know if there is a better way. Also can't say much about the use-case of third-party cameras.
EDIT:
On further inspection, there is a better way. Listening to android.media.action.IMAGE_CAPTURE would yield better results and should fit right into your requirements.
Related
I created a background service on android and I have two buttons which appear on the top of the screen all the time. I want to use these two buttons like scroll down and scroll up. But these two buttons should work on any kind of applications like Instagram, Facebook, Twitter and so. So, it means it should work in all applications that use scrolling.
I search a week on internet but I could not find any solutions.
This is not possible, sorry. Something like this would require your Service to have access to the Views of the applications and this would be a huge security breach, because you could read values from them and so on.
You could achieve this with a custom button code broadcast (so basically your buttons would act as physical buttons on the device) but this would most probably require you to have system-level permissions and some level of cooperation with the OEMs.
Android Activity class has a method called dispatchKeyEvent(), which could let you simulate the key input (with some limitations) but this is not present in the Service class.
Sadly this is not something you can do in Android. Typically you should not be able to touch views with a background service, the point of a background service is that you do some work in it (for example upload files to your web server or get some data). You CAN send a signal from a service once you're finished doing work to tell an app that something needs to happen, however the app needs to be specifically coded to respond to this broadcasted event.
If you wanted to do this with an app that you have developed, that can be achieved by using the onReceive method of say a BroadcastReceiver, however you cannot specifically define the behaviour of other apps as this would represent a security breach in Android.
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.
Hey does anyone know if it's possible to intercept incoming calls via an app for both IOS and Android (no jailbreak) then based on certain criteria the phone takes action?
Have already read a few posts saying it's not possible however they are quite old, anyone know of anything new?
Thanks!
The short answer:
On Android: You can do this, but this may require special treatment for different vendors and/or OS versions. It won't be simple to support all (or at least most) devices, but with a lot of manual trial and error, it can be done.
On iOS: It's not possible locally, as Apple sees it as an invasion to the user's privacy.
The (slightly) longer explanation:
What is possible, for both iOS and Android, but will probably require a lot more work and external support than you originally planned, is to divert the calls via a server. This way, when someone calls you, the call is "stolen" by the server (which the user has to manually allow when installing the app) and the call is received on your device as a VOIP call, allowing the app (on the server side) full control over the call (which ones are actually received on the device, what's played, how long, recording, etc). You can see this app for an example of how it works: https://yallo.com/.
I hope this helps. Good Luck.
It's the first time I post here, and I am a non-native speaker. So please forgive me if there is any bad grammar.
I am working on a project that wants to detect this:
When an app A sends some data to another app B and app B behaves abnormally after receiving the data, the app I wrote should send an notification to users.
For example, app B's memory usage suddenly shoots up to, say, 50%.
However, after searching, I found a post that says it is impossible to detect/intercept explicit intent sent between apps.
Does that mean I have no way to tell whether two apps communicate with each other?
ps: I know that it is possible to detect implicit intents, but that's not what I want.
Thank you!
As you suggested, there is no way to tell whether two apps communicate with each other, so what you're asking simply isn't possible.
Here is the thing, when you are sharing using android Google plus this what it does:
For your first attempt to share anything, you will get 5 steps process when you be asked to think all what you got(including your sole) with Google plus app.
Then you will be finally redirected to the share activity, witch at first starting by 5 sec of loading in order to attach your current location to the post.
Lets ignore for a sec about the first(unforgettable) time. But for all the rest of times when I wish to share some thing from my app, how can I do this WITHOUT attaching my users location?
You can't. When you broadcast an Intent to share something (like text) and the user selects an app to complete the action, it's completely out of your control. There are (thankfully) no flags you can set to disallow things like attaching location on the other end of the Intent.
Think about the implications of allowing the sender of an intent to dictate how the reciever handles it. You can't predict how the user will want to share something. If they don't want to share location, they'll remove it. If they do want to share location, you shouldn't be able to block them. If they don't like how slow Google Plus is, they won't use it.
This isn't your problem and trying to make it yours will only frustrate users.