Cannot get photo capture to load on device

Jun 2, 2011 at 3:37 PM

Hi there.

I've copied your sample code from the Documentation tab and it works fine on the emulator, but if I try to run it on my phone, the below line isn't happy:

 WP7BarcodeManager.ScanBarcode(BarcodeResults_Finished); //Provide callback method

The screen on my phone looks like it's trying to fire up the camera, but instantly switches back to the application.  In the callback method, the BCResults.ErrorMessage property is 'Error: Photo capture cancelled'... I'm using a HTC HD7, developer unlocked device.

Any ideas? bBypassCamera is also set to false.

Thanks

Steve

Jun 2, 2011 at 4:00 PM

Just found out, it's because I had the phone plugged in via Zune interface, for some reason it doesn't like you debugging the CameraCaptureTask while the phone is connected!!

 

See here: http://forums.create.msdn.com/forums/p/70537/431261.aspx

Coordinator
Jun 8, 2011 at 5:29 PM

Correct, you cannot use the camera when the phone is connected to the Zune software. This is true both of the emulator and the real device. Unfortunately there is no simple way to check if the device is connected or not. I end up checking how fast the ScanBarcode method takes to return, and if it is less than 1 or 2 seconds I assume it was canceled due to the phone being connected to the Zune software and prompt the user to disconnect from the computer and try again.

Sidenote: If you use the WPConnect software instead of the Zune software you will be able to debug using the camera capture on a real phone (emulator doesnt support camera at all). This can be helpful for finding issues with resolution or focus. Otherwise you can use the bBypassCamera, BarcodePhotoChooser.xaml, and BarcodeSampleItemManager.cs classes to test using sample images.