I want to take a picture from a non-activity Thread (a web server running on the device).
In order to do this, I wanted to have a Service bound to the Application, that I could call which would take a picture, and return the Bitmap when done. But it looks like I can't do that because for security purposes Android forbids to take picture without showing a preview (even with a dummy preview like shown on the accepted answer here, on some devices)
I then wanted to have an Activity that takes the picture for me, with a real preview, but I can't think of any way to do this either because:
I can't get the Bitmap back because I can't call
startActivityForResult()
as my web server is not an Activity, so I can't overrideonActivityResult()
. (The webServer just has a reference of the instance of the Application)I can't just pass the HttpRequest along with the Intent for the Activity to respond to it, because the Response object is not parcellable?
How would you do something like that in the most logical/elegant way possible?