Question

i'm working with junaio template (augmented reality) for android and i added a button named 'Scan' that will scan a qr code. I need to know what method/function/class or API do i have to implement on android to make that action work. Is there any of this for android?.

Thank in advance!.

PS: i've heard of Zxing but if i'm not wrong that app needs to be installed on the phone and i don't want to since i'm developing my own app that i intend it will do the whole job.

Was it helpful?

Solution

In order to implement the scan functionality in junaio, you would have to set the Tracking configuration "arel.Tracking.BARCODE_QR" ( http://dev.junaio.com/arel/documentationArelJS/symbols/arel.Tracking.html )

Every time a QR-code is scanned, you will get a callback through the onTrackingEvent callback. In that callback you can then decide which action you want to perform.

OTHER TIPS

I do not know but you can study ZXing source code how they do it http://code.google.com/p/zxing/source/checkout

Ok, here is the situation, I've made some suggested changes on the code so it can scan QR codes. The changes I did where made on the file index.php which is inside of the folder arel.

<script type="text/javascript">


        arel.sceneReady(function()
        {
            //start with arel here  
            arel.Scene.setTrackingConfiguration(arel.Tracking.BARCODE_QR);          
            //set a listener to tracking to get information about when the image is tracked
            arel.Events.setListener(arel.Scene, function(type, param){trackingHandler(type, param);});          
             //if the user holds the device over the pattern already, when the scene starts
            arel.Scene.getTrackingValues(function(trackingValues){receiveTrackingStatus(trackingValues);});         

        }); 

        function trackingHandler(type, param)
            {
                //check if there us tracking information avaialbe
                if(param[0] !== undefined)
                {
                    //if the pattern is found, hide the information to hold your phone over the pattern
                    if(type && type == arel.Events.Scene.ONTRACKING && para[0].getState() == arel.Tracking.STATE_TRACKING)
                    {
                         $('#info').fadeOut("fast");
                      }                     
                    //if the pattern is lost tracking, show the information to hold your phone over the pattern
                      else if(type && type == arel.Events.Scene.ONTRACKING && param[0].getState() == arel.Tracking.STATE_NOTTRACKING)
                      {
                         $('#info').fadeIn("fast");
                      } 

                }
            };

            function receiveTrackingStatus(trackingValues)
            {
               if(trackingValues[0] === undefined)
                  $('#info').fadeIn("fast");

            };  

        </script>

The problem here is that it doesn't scan any code, I put the phone to scan a code and nothing happens... anyone has an idea of what I'm doing wrong here?... I'll apreciate any help.

Thanks.

Ignacio.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top