Parameters of your HTC  camera should be set properly, you have to know your
camera's capability. Suggest you give small resolution as parameters.

On Fri, Oct 29, 2010 at 1:07 AM, Elysium <[email protected]> wrote:

> Hi Guys!
> I'm coding a little app, but I don't know what I'm doing wrong.
> The App does the following:
> - Launches a Service which listens for an sms, then captures a picture
> with the cam and sends it to a predefined email adress. (no, i'm not
> trying to spy somebody out... I'm using the app to get a "3G-Webcam",
> sort of at least)
>
> The problem:
> My App works great in the emulator, but as soon as I try it on my HTC
> Magic (cm6, android 2.2) it stops working.
>
> logcat:
> 10-28 19:05:31.190: DEBUG/QualcommCameraHardware(91): createInstance:
> E
> 10-28 19:05:31.599: DEBUG/QualcommCameraHardware(91): createInstance:
> X created hardware=0x3bac0
> 10-28 19:05:31.719: ERROR/QualcommCameraHardware(91):
> native_set_dimension: length: 28.
> 10-28 19:05:31.769: DEBUG/QualcommCameraHardware(91): snapshot_thread
> E
> 10-28 19:05:35.939: DEBUG/skia(26561): purging 114K from font cache
> [11 entries]
> 10-28 19:05:36.270: DEBUG/dalvikvm(26561): JIT code cache reset in 2
> ms (524208 bytes 1/0)
> 10-28 19:05:36.270: DEBUG/dalvikvm(26561): GC_EXPLICIT freed 15951
> objects / 694856 bytes in 329ms
> 10-28 19:05:36.770: ERROR/QualcommCameraHardware(91):
> native_get_picture: MSM_CAM_IOCTL_GET_PICTURE fd 18 error Connection
> timed out
> 10-28 19:05:36.770: ERROR/QualcommCameraHardware(91): getPicture
> failed!
> 10-28 19:05:36.770: DEBUG/QualcommCameraHardware(91): snapshot_thread
> X
>
> The permissions are all set, even the write to SD-card. What am I
> missing?
>
> Note: I'm not using a surfaceview.
> Code:
>
> public void takePictureAndSendByMail() {
>                        new Task().execute();
>                }
>
>                PictureCallback jpegCallback = new PictureCallback() {
>                        public void onPictureTaken(byte[] data, Camera
> camera) {
>                                FileOutputStream outStream = null;
>                                try {
>                                        File storagepath =
> Environment.getExternalStorageDirectory();
>                                        filename = String.format(storagepath
> + "/%d.jpg",
> System.currentTimeMillis());
>                                        outStream = new
> FileOutputStream(filename);
>                                        outStream.write(data);
>                                        outStream.close();
>                                        Log.d("E", "onPictureTaken - wrote
> bytes: " + data.length);
>                                } catch (FileNotFoundException e) {
>                                        e.printStackTrace();
>                                } catch (IOException e) {
>                                        e.printStackTrace();
>                                } finally {
>                                }
>                                Log.d("E", "onPictureTaken - jpeg");
>
>                                mCamera.release();
>                        }
>
>                };
>
>
>                private class Task extends AsyncTask<Void, Void, Void> {
>
>                        protected void onPreExecute() {
>                                mCamera = Camera.open();
>
>                                Camera.Parameters parameters =
> mCamera.getParameters();
>
>                                mCamera.setParameters(parameters);
>                        }
>
>                        protected Void doInBackground(Void... unused) {
>
>                                try {
>                                mCamera.takePicture(null, null,
> jpegCallback);
>
>                                } catch (Exception e) {
>                                        Log.v("Error: ", "Exception", e);
>                                }
>
>                                return null;
>                        }
>
>                        protected void onPostExecute(Void unused) {
>
>                        }
>
>                }
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to