6

I´m trying to use the zxing on the google glass, however i´m receiving the error above.

I using the zxing 2.2 core.jar I also receive this error message on the device display "Sorry, the android camera encountered a problem. You may need to restart the device".

I´m lauching a intent on my oncreate activity

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
startActivityForResult(intent, 0);
}

Eclipse Error Message

12-16 15:29:24.578: I/PlatformSupportManager(2150): Using implementation class com.google.zxing.client.android.camera.open.GingerbreadOpenCameraInterface of interface com.google.zxing.client.android.camera.open.OpenCameraInterface for SDK 9

12-16 15:29:24.578: I/GingerbreadOpenCamera(2150): Opening camera #0

**12-16 15:29:24.585: W/CaptureActivity(2150): Unexpected error initializing camera**

12-16 15:29:24.585: W/CaptureActivity(2150): java.lang.RuntimeException: Fail to connect to camera service
12-16 15:29:24.585: W/CaptureActivity(2150):    at android.hardware.Camera.native_setup(Native Method)

12-16 15:29:24.585: W/CaptureActivity(2150):    at android.hardware.Camera.<init>(Camera.java:374)

12-16 15:29:24.585: W/CaptureActivity(2150):    at android.hardware.Camera.open(Camera.java:315)

12-16 15:29:24.585: W/CaptureActivity(2150):    at com.google.zxing.client.android.camera.open.GingerbreadOpenCameraInterface.open(GingerbreadOpenCameraInterface.java:57)

12-16 15:29:24.585: W/CaptureActivity(2150):    at com.google.zxing.client.android.camera.CameraManager.openDriver(CameraManager.java:78)

GDK Camera References (https://developers.google.com/glass/develop/gdk/reference/com/google/android/glass/media/Camera)

There is not a lot information about how use it, however there are other questions like this one

Google Glass preview image scrambled with new XE10 release

that make me think that is possible to use the zxing on glass.

Community
  • 1
  • 1
Oximer
  • 548
  • 5
  • 19

2 Answers2

3

I not including

<uses-permission android:name="android.permission.CAMERA"/>

at the top of my manifest.

This is blocking my camera to open.

If someone is trying to integrate zxing i suggest use this tutorial.

http://damianflannery.wordpress.com/2011/06/13/integrate-zxing-barcode-scanner-into-your-android-app-natively-using-eclipse/

Oximer
  • 548
  • 5
  • 19
  • HI Jose, Are you able to successfully run zxing in google glass and scan a QR Code with the tutorial you mentioned ? – Vny Kumar Dec 18 '13 at 04:07
  • 2
    Yes, i have only to adjust some settings on the camera. http://stackoverflow.com/questions/19235477/google-glass-preview-image-scrambled-with-new-xe10-release – Oximer Dec 18 '13 at 14:29
  • I could not get ZXing to compile at all with the above tutorial. Can you provide anymore insight about how you got it to work or provide an apk of working zxing for glass? – calumb Jan 08 '14 at 15:07
  • In which step are you having trouble? Be more specif, so i could help you. – Oximer Jan 08 '14 at 16:20
  • I downloaded the code for zxing, and got the jar, but I can't get the code to compile because of errors with jave 1.6 vs 1.7. The ZXing code appears to use many features of 1.7, but my ADT (eclipse) won't let me compile for android with 1.7, so I am a little stuck on what to do. – calumb Jan 10 '14 at 06:15
  • On 2013/12/02, the zxing made the following commit that made the code no longer compatible with Eclipse 1.6 Java compiler limitation: https://github.com/zxing/zxing/commit/a53c659b0e54646979649d550f9ab141c9826a67 While Eclipse is broken, it should compile fine in Android Studio. Someone could also create a fork from an earlier commit and add back in the code required to make this compile on JDK 6 (1.6). – swooby Jan 17 '14 at 16:51
  • Actually, dex handles Java 7 bytecode just fine. (Just don't use `AutoCloseable`). Eclipse can most certainly be set to compile for Java 7. – Sean Owen Jan 22 '14 at 16:15
1

This project BarcodeEye is a port of ZXing to Google glass that is working.

The source is online. It solved for my use case

https://github.com/BarcodeEye/BarcodeEye

StanleyZheng
  • 4,008
  • 3
  • 21
  • 24
  • Were you able to call BarcodeEye as an intent? I am having trouble integrating it with my app. – calumb Jan 11 '14 at 23:50
  • What are you trying to scan? Are you trying to get a standard type to invoke (phone, email, url). I also looked into setting a custom mime-type for the scanner to handle. http://stackoverflow.com/questions/5744944/how-to-add-custom-mime-type – StanleyZheng Jan 12 '14 at 15:08
  • This question was also very helpful on my understanding on intent integration http://stackoverflow.com/questions/4854442/embed-zxing-library-without-using-barcode-scanner-app – StanleyZheng Jan 12 '14 at 16:33
  • I wouldn't recommend barcode eye. First it's not easy to implement and then it has trouble to detect 1d barcodes on glass. At least in my setup. The barcode needed to be like 20 cm large to be recognized ... – Anthea Feb 05 '16 at 08:18
  • @anthea those were my findings after a few weeks. I ran into the same zoom focus issues in the SDK. I went with a closed source solution http://www.scandit.com/ after. This is many moons again on XE16 of glass and many other policies may of changed. – StanleyZheng Feb 05 '16 at 16:45
  • @stanzheng Thanks, for your reply after all this time :) What were your experiences with scandit? Did it work well on your glass? – Anthea Feb 08 '16 at 10:30
  • Scandit worked great, they had gotten around the focus issue on their product and were gearing their product towards glass as a scanner tool. They're probably farther along or shelved their effort but what i was working on was similar to this: http://www.scandit.com/2014/04/22/barcode-scanning-with-google-glass-pick-by-vision-app-video/ – StanleyZheng Feb 08 '16 at 15:03