Using zxing on Google Glass
Asked Answered
L

2

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.

Leatheroid answered 16/12, 2013 at 17:56 Comment(0)
L
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/

Leatheroid answered 16/12, 2013 at 18:34 Comment(7)
HI Jose, Are you able to successfully run zxing in google glass and scan a QR Code with the tutorial you mentioned ?Bolten
Yes, i have only to adjust some settings on the camera. #19235977Leatheroid
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?Recliner
In which step are you having trouble? Be more specif, so i could help you.Leatheroid
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.Recliner
On 2013/12/02, the zxing made the following commit that made the code no longer compatible with Eclipse 1.6 Java compiler limitation: github.com/zxing/zxing/commit/… 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).Parra
Actually, dex handles Java 7 bytecode just fine. (Just don't use AutoCloseable). Eclipse can most certainly be set to compile for Java 7.Mistranslate
M
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

Morganatic answered 10/1, 2014 at 19:26 Comment(7)
Were you able to call BarcodeEye as an intent? I am having trouble integrating it with my app.Recliner
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. https://mcmap.net/q/385206/-how-to-add-custom-mime-typeMorganatic
This question was also very helpful on my understanding on intent integration #4854942Morganatic
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 ...Insufflate
@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 scandit.com after. This is many moons again on XE16 of glass and many other policies may of changed.Morganatic
@stanzheng Thanks, for your reply after all this time :) What were your experiences with scandit? Did it work well on your glass?Insufflate
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: scandit.com/2014/04/22/…Morganatic

© 2022 - 2024 — McMap. All rights reserved.