GS1-128 Decoder for android [duplicate] - java

In my app I want to scan a GS1-128 barcode, and need the FNC1 characters passed from the ZXing barcode scanner.
Right now I just receive the plain text without the FNC1 characters.
Is there a way to pass the DecodeHintType.ASSUME_GS1 via Intent to the scanner app?
I don't want to include the complete scanner source in my app and rather use the Intent.
In the source code of the scanner I can see that the DecodeHintType needs to be set to achive that:
https://code.google.com/p/zxing/source/browse/trunk/core/src/main/java/com/google/zxing/oned/Code128Reader.java
boolean convertFNC1 = hints != null && hints.containsKey(DecodeHintType.ASSUME_GS1);
Thanks for any help.
I searched almost the whole web and didn't find an answer to this.
This is driving me nuts...

At the end it turned out that it was easier than I thought:
intentScan.putExtra("ASSUME_GS1", true);
The hints can be set with extras.
I just had to figure it out, because I couldn't find it anywhere how to do that.
I downloaded the code of the Barcode Scanner and did a little debugging.
But now I can use the original app and get the barcode via Intent. :-)

Yes, that's the hint you need. It will return FNC1 as ASCII 29. There's not a general way to pass the hints by Intent, but some are supported as additional Intent extras. If you want to submit a patch that triggers this hint I'll take a look.

Related

android Speech recognition API.System always recognizes default language

Here is how my code looks.
//loc will be either "ru-RU" or "en-US"
speechRecognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
speechRecognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
speechRecognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, loc);
speechRecognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, loc);
speechRecognizerIntent.putExtra(RecognizerIntent.EXTRA_ONLY_RETURN_LANGUAGE_PREFERENCE, loc);
Problem is that, when I am using the program with different phones it works well.But with my cell phone it always chooses default language. And rare times it is just mixing recognition languages. Like half of the result is in one language other half in another language.
I dont know whether it is cause of system or from code itself?
Plus It worked well before on my phone too. Can it be cause of some settings?
How can I overcome and fix it? I need to know to inform users how to fix it if they will have the same problem
How can I use voice recognition with other languages android
SpeechRecognizer with Google Search version 3.6.14.1337016 can't recognize other voice language except default
Firstly, the problem exists while using SpeechRecognizer
On this case only solution was to delete google search cause it is related to google search update. Doing so we will delete all updates. This worked on my own device
But on my opinion,actually, small updates should not change api behaviour. I hope there is programmatic way to solve this issue or there will be new update that will fix it
Here is undocumented programmatic solve:
intent.putExtra("android.speech.extra.EXTRA_ADDITIONAL_LANGUAGES", new
String[]{});
it is artetxem's answer
Other solution is just to call activity for recognition. This way google's dialog activity will be seen but there will be no language problems.
Issue opened by me issue
Issue opened on google search by artetxem issue
Hi #VSL i was also facing same problem to set language hindi instead of english, but Speech recognizer always take my Android OS default language which is english. But below code solved my problem
Intent recognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "hi");
recognizerIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, InteractionActivity.this.getPackageName());
recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
recognizerIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 3);
speech.startListening(recognizerIntent);

Logic of Java barcode reader for libraryMS

I have to do a library Magement System in Java Swing. I had done it well with all your supports. Thank you all. Now this s/w needs to identify book and students by barcode (1d). I couldn't get a perfect logic from any where. I have read in SO and other web. I got some logic. But the vision is not clear.
I know this.
bar-code scanner output to port - listen to key strock- need Interface
My doubt is
What the order of the logic flow. ?
do i have to add any lib/jar files to do it.
how to implement this?
I have read a focused text field is needed. How to know did the scanner end key stocks.
I am totally confused. Sorry for reading poor English. I will make up this
Advanced thanks for all your support .
Read the picture from the reader (depends on the hardware, you might need to use the proprietary API or whatever it requires)
Use a barcode reading library to 'parse' the picture. (like zxing, which maybe can access a camera?)
which will give you the number hidden in the barcode.

Changing audio input using Java?

I'd like to modify the audio input stream, the stream that would come
from my microphone.
I have looked through the java.sound package API, but did not entirely understand it,
nor how to modify direct sound input.
Does anyone here know how to do that, or know an API that is capable of doing it?
You want a mixture of things:
The Java Sound system: http://www.oracle.com/technetwork/java/index-139508.html
A trail for it: http://docs.oracle.com/javase/tutorial/sound/index.html
Using audio controls: http://docs.oracle.com/javase/1.5.0/docs/guide/sound/programmer_guide/chapter6.html (part of a wider set of documentation)
If you are able to give more information about what you want to do to the audio stream, it's likely we'll be able to give you more specific advice.

Swing choose device to read ASCI string input from

I have several devices that install as HID keyboard devices in most any operating system and, when used, send a string of text back, just like a keyboard. Is there any way in a Swing app to listen only to a chosen device, ignoring the standard keyboard, and do it without a TextComponent to capture the data? Thanks!
For anyone who comes across via google, etc, here is the solution I finally found.
(This is a solution to the second part of my question, how to capture input without a TextComponent).
I followed this tutorial and attached a KeyListener to my program. This allowed me to capture and parse input, albeit rather awkwardly. I have yet to find a smoother solution to this.
I may come back and add code to this. Please leave a comment if I have not yet done so and you would find it helpful

using raw-data from an infinite input and playing it on the device

I would like to know how to capture data(media) from an infinite input stream(eg. internet radio) and play it on the android device.Most of the tutorials i have gone through, tell me to use the MediaPlayer class. But the problem is that i want to capture that raw data in a byte array and then play it from that byte array itself.Does anyone know how to do this?
have you checked the AudioRecord class? with it you can record audio from sources, i.e. a MIC and read into a byte[], the class for reading out of a byte[] would be AudioTrack. please find the links within this post.
http://developer.android.com/reference/android/media/AudioRecord.html
http://developer.android.com/reference/android/media/AudioTrack.html
hope it will help.
as you said, you want to capture from internet radio, i am not sure how to do that. sorry

Categories

Resources