One place I have encountered that error is if the Camera is already in
use (by you or another app on the device).

On Sun, Nov 27, 2011 at 7:33 PM, Pedro Teixeira
<[email protected]> wrote:
> Hi,
>
> I have a location based application that depending on the position of
> the use relating to a certain spot it turns on the camera. In layman
> terms, when there's proximity to a place it triggers the camera.
>
> If I'm already near the sport when it's suppose to trigger ( I've
> build a proximity algorithm based on user position (lat,long) and the
> spot position) the camera mode opens just fine trough an intent that
> calls the activity where the camera access is implemented.
>
> But if I'm walking towards the spot and the trigger is set I get an
> error. This is the logcat:
>
> 11-27 20:03:42.451: E/AndroidRuntime(1380): Uncaught handler: thread
> main exiting due to uncaught exception
> 11-27 20:03:42.541: E/AndroidRuntime(1380):
> java.lang.RuntimeException: Fail to connect to camera service
> 11-27 20:03:42.541: E/AndroidRuntime(1380):     at
> android.hardware.Camera.native_setup(Native Method)
> 11-27 20:03:42.541: E/AndroidRuntime(1380):     at
> android.hardware.Camera.<init>(Camera.java:85)
> 11-27 20:03:42.541: E/AndroidRuntime(1380):     at
> android.hardware.Camera.open(Camera.java:67)
> 11-27 20:03:42.541: E/AndroidRuntime(1380):     at
> com.pedroteixeira.thennnow.thenNnowMode.surfaceCreated(thenNnowMode.java:
> 229)
> 11-27 20:03:42.541: E/AndroidRuntime(1380):     at
> android.view.SurfaceView.updateWindow(SurfaceView.java:392)
> 11-27 20:03:42.541: E/AndroidRuntime(1380):     at
> android.view.SurfaceView.dispatchDraw(SurfaceView.java:264)
> 11-27 20:03:42.541: E/AndroidRuntime(1380):     at
> android.view.ViewGroup.drawChild(ViewGroup.java:1524)
> 11-27 20:03:42.541: E/AndroidRuntime(1380):     at
> android.view.ViewGroup.dispatchDraw(ViewGroup.java:1256)
> 11-27 20:03:42.541: E/AndroidRuntime(1380):     at
> android.view.ViewGroup.drawChild(ViewGroup.java:1524)
> 11-27 20:03:42.541: E/AndroidRuntime(1380):     at
> android.view.ViewGroup.dispatchDraw(ViewGroup.java:1256)
> 11-27 20:03:42.541: E/AndroidRuntime(1380):     at
> android.view.View.draw(View.java:6277)
> 11-27 20:03:42.541: E/AndroidRuntime(1380):     at
> android.widget.FrameLayout.draw(FrameLayout.java:352)
> 11-27 20:03:42.541: E/AndroidRuntime(1380):     at
> android.view.ViewGroup.drawChild(ViewGroup.java:1526)
> 11-27 20:03:42.541: E/AndroidRuntime(1380):     at
> android.view.ViewGroup.dispatchDraw(ViewGroup.java:1256)
> 11-27 20:03:42.541: E/AndroidRuntime(1380):     at
> android.view.View.draw(View.java:6277)
> 11-27 20:03:42.541: E/AndroidRuntime(1380):     at
> android.widget.FrameLayout.draw(FrameLayout.java:352)
> 11-27 20:03:42.541: E/AndroidRuntime(1380):     at
> com.android.internal.policy.impl.PhoneWindow
> $DecorView.draw(PhoneWindow.java:1883)
> 11-27 20:03:42.541: E/AndroidRuntime(1380):     at
> android.view.ViewRoot.draw(ViewRoot.java:1332)
> 11-27 20:03:42.541: E/AndroidRuntime(1380):     at
> android.view.ViewRoot.performTraversals(ViewRoot.java:1097)
> 11-27 20:03:42.541: E/AndroidRuntime(1380):     at
> android.view.ViewRoot.handleMessage(ViewRoot.java:1613)
> 11-27 20:03:42.541: E/AndroidRuntime(1380):     at
> android.os.Handler.dispatchMessage(Handler.java:99)
> 11-27 20:03:42.541: E/AndroidRuntime(1380):     at
> android.os.Looper.loop(Looper.java:123)
> 11-27 20:03:42.541: E/AndroidRuntime(1380):     at
> android.app.ActivityThread.main(ActivityThread.java:4203)
> 11-27 20:03:42.541: E/AndroidRuntime(1380):     at
> java.lang.reflect.Method.invokeNative(Native Method)
> 11-27 20:03:42.541: E/AndroidRuntime(1380):     at
> java.lang.reflect.Method.invoke(Method.java:521)
> 11-27 20:03:42.541: E/AndroidRuntime(1380):     at
> com.android.internal.os.ZygoteInit
> $MethodAndArgsCaller.run(ZygoteInit.java:791)
> 11-27 20:03:42.541: E/AndroidRuntime(1380):     at
> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
> 11-27 20:03:42.541: E/AndroidRuntime(1380):     at
> dalvik.system.NativeStart.main(Native Method)
>
> Does anyone have any idea what can it be? I'm stuck with this issue.
>
> Thank you so much in advance. All help and tips are highly
> appreciated.
>
> Pedro
>
> --
> 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
>



-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android 3.2 Programming Books: http://commonsware.com/books

-- 
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