<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Avaneesh Kumar on Medium]]></title>
        <description><![CDATA[Stories by Avaneesh Kumar on Medium]]></description>
        <link>https://medium.com/@avaneeshkumarmaurya?source=rss-e85ece9db3be------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Og6hIjV-oDs-ma9qT_Z-0g.jpeg</url>
            <title>Stories by Avaneesh Kumar on Medium</title>
            <link>https://medium.com/@avaneeshkumarmaurya?source=rss-e85ece9db3be------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 00:59:29 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@avaneeshkumarmaurya/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Android Barcode Reader and Qr Code Scanner using Google Mobile Vision]]></title>
            <link>https://medium.com/cashify-engineering/barcode-reader-using-google-mobile-vision-88b3e9f31668?source=rss-e85ece9db3be------2</link>
            <guid isPermaLink="false">https://medium.com/p/88b3e9f31668</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[barcode]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[qr-code]]></category>
            <category><![CDATA[vision]]></category>
            <dc:creator><![CDATA[Avaneesh Kumar]]></dc:creator>
            <pubDate>Sat, 28 Jul 2018 11:02:57 GMT</pubDate>
            <atom:updated>2018-12-24T05:52:06.464Z</atom:updated>
            <content:encoded><![CDATA[<p>Google’s Vision API has replaced the ZXING QR Scanner that we were using earlier. Apart from barcode scanning, it serves multiple purposes including face detection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*J3FT0ITa3fih3xMEi8VsJw.jpeg" /></figure><h4>Advantage over legacy ZXING scanner</h4><p>Google vision API is faster. It can scan calendars and business cards.<br>I am attaching a QR code with a calendar event.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/170/1*EWrRFY0JbgNw1ts0bVAOKg.gif" /><figcaption>Calendar event QrCode</figcaption></figure><p>When we scan above QR code with vision API, we get the following:</p><pre>BEGIN:VEVENT<br>SUMMARY:Cashify meet up<br>LOCATION:Gurgaon, India<br>URL:<a href="http://www.cashify.in/">www.cashify.in</a><br>DESCRIPTION:Hello,We are live on the given date.<br>DTSTART:20180701T090000<br>DTEND:20180701T210000<br>END:VEVENT</pre><p>Besides calendars, we can also scan contacts, driving licenses and more.</p><p>I have created a sample of the above mentioned facility.</p><h3>How to use Barcode Reader Using Google Mobile Vision</h3><p><a href="https://github.com/avaneeshkumarmaurya/Barcode-Reader">avaneeshkumarmaurya/Barcode-Reader</a></p><blockquote>1. Click the above link, download the project and import barcode-reader as module</blockquote><blockquote>2. Include the barcode reader dependency in app’s build.gradle</blockquote><pre>dependencies {<br>    // google vision gradle<br>    implementation &#39;com.google.android.gms:play-services-vision:15.0.2&#39;<br>}</pre><blockquote>3. You can just launch the scanner activity by calling this method</blockquote><pre>Intent launchIntent = BarcodeReaderActivity.getLaunchIntent(this, true, false);<br>        startActivityForResult(launchIntent, BARCODE_READER_ACTIVITY_REQUEST);</pre><blockquote>and get the result into onActivityResult:</blockquote><pre>protected void onActivityResult(int requestCode, int resultCode, Intent data) {<br>        super.onActivityResult(requestCode, resultCode, data);<br><br>        if (resultCode != Activity.RESULT_OK) {<br>            Toast.makeText(this, &quot;error in  scanning&quot;, Toast.LENGTH_SHORT).show();<br>            return;<br>        }<br><br>        if (requestCode == BARCODE_READER_ACTIVITY_REQUEST &amp;&amp; data != null) {<br>            Barcode barcode = data.getParcelableExtra(BarcodeReaderActivity.KEY_CAPTURED_BARCODE);<br>            Toast.makeText(this, barcode.rawValue, Toast.LENGTH_SHORT).show();<br>        }<br><br>    }</pre><blockquote>4. If you want to make your own activity, implement the activity from BarcodeReader.BarcodeReaderListener and override the necessary methods.</blockquote><pre>public class BarcodeReaderActivity extends AppCompatActivity implements BarcodeReaderFragment.BarcodeReaderListener {<br>    private BarcodeReaderFragment mBarcodeReaderFragment;<br><br>    @Override<br>    protected void onCreate(Bundle savedInstanceState) {<br>        super.onCreate(savedInstanceState);<br>        setContentView(R.layout.activity_barcode_reader);<br>        mBarcodeReaderFragment = attachBarcodeReaderFragment();<br>    }<br><br>    private BarcodeReaderFragment attachBarcodeReaderFragment() {<br>        final FragmentManager supportFragmentManager = getSupportFragmentManager();<br>        final FragmentTransaction fragmentTransaction = supportFragmentManager.beginTransaction();<br>        BarcodeReaderFragment fragment = BarcodeReaderFragment.newInstance(true, false);<br>        fragment.setListener(this);<br>        fragmentTransaction.replace(R.id.fm_container, fragment);<br>        fragmentTransaction.commitAllowingStateLoss();<br>        return fragment;<br>    }<br><br>   <br><br>    @Override<br>    public void onScanned(Barcode barcode) {<br>    }<br><br>    @Override<br>    public void onScannedMultiple(List&lt;Barcode&gt; barcodes) {<br><br>    }<br><br>    @Override<br>    public void onBitmapScanned(SparseArray&lt;Barcode&gt; sparseArray) {<br><br>    }<br><br>    @Override<br>    public void onScanError(String errorMessage) {<br><br>    }<br><br>    @Override<br>    public void onCameraPermissionDenied() {<br><br>    }<br>}</pre><h3>Adding Barcode Reader in Fragment</h3><p>In fragment the barcode reader can be added easily but the scanner listener barcodeReader.setListener() has to be set manually.</p><p>Check the example fragment code in BarcodeFragment.java and MainActivity.java</p><p><a href="https://github.com/avaneeshkumarmaurya/Barcode-Reader/blob/master/app/src/main/java/com/notbytes/barcodereader/BarcodeFragment.java">https://github.com/avaneeshkumarmaurya/Barcode-Reader/blob/master/app/src/main/java/com/notbytes/barcodereader/BarcodeFragment.java</a></p><h3>Adding Scanner Overlay Scanning Indicator</h3><p>The overlay animation indicator displays a horizontal line animating from top to bottom. This can be useful in showing cool animations to indicate scanning progress.</p><p>To use it, add the com.notbytes.barcode_reader.ScannerOverlay on top of barcode reader fragment using Relative or Frame layout.</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br>&lt;RelativeLayout ...&gt;</pre><pre>    &lt;fragment<br>        android:id=&quot;@+id/barcode_fragment&quot;<br>        android:name=&quot;com.notbytes.barcode_reader.BarcodeReaderFragment&quot;<br>        android:layout_width=&quot;match_parent&quot;<br>        android:layout_height=&quot;match_parent&quot;<br>        app:auto_focus=&quot;true&quot;<br>        app:use_flash=&quot;false&quot; /&gt;</pre><pre>    &lt;com.notbytes.barcode_reader.ScannerOverlay<br>        android:layout_width=&quot;match_parent&quot;<br>        android:layout_height=&quot;match_parent&quot;<br>        android:background=&quot;#44000000&quot;<br>        app:line_color=&quot;#7323DC&quot;<br>        app:line_speed=&quot;6&quot;<br>        app:line_width=&quot;5&quot;<br>        app:square_height=&quot;250&quot;<br>        app:square_width=&quot;250&quot; /&gt;</pre><pre>&lt;/RelativeLayout&gt;</pre><h3>Additional Options</h3><p>XML attribute for Barcode Reader</p><p>auto_focus - boolean, turn on/off auto focus. Default is true</p><p>use_flash - boolean, turn on/off flash. Default is false</p><p>XML attribute for Scanner Overlay Indicator</p><p>square_width - Width of transparent square</p><p>square_height - Height of transparent square</p><p>line_color - Horizontal line color</p><p>line_speed - Horizontal line animation speed</p><p>JAVA Methods</p><ul><li>Play beep sound</li></ul><p>You can play the beep sound when a barcode is scanned. This code is usually called in onScanned() callback.</p><pre>    @Override<br>    public void onScanned(final Barcode barcode) {<br>        Log.e(TAG, &quot;onScanned: &quot; + barcode.displayValue);<br>        barcodeReader.playBeep();<br>        });<br>    }</pre><ul><li>Change beep sound</li></ul><p>You can change the default beep sound by passing the file name. Your beep file should be in the project’s assets folder.</p><pre>barcodeReader.setBeepSoundFile(&quot;shutter.mp3&quot;);</pre><ul><li>Pause scanning</li></ul><p>The scanning can be paused by calling pauseScanning() method.</p><pre>barcodeReader.pauseScanning();</pre><ul><li>Resume Scanning</li></ul><p>The scanning can be resumed by calling resumeScanning() method.</p><pre>barcodeReader.resumeScanning();</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=88b3e9f31668" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cashify-engineering/barcode-reader-using-google-mobile-vision-88b3e9f31668">Android Barcode Reader and Qr Code Scanner using Google Mobile Vision</a> was originally published in <a href="https://medium.com/cashify-engineering">Cashify Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>