Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

Barcodescanner não abre no celular

Vi que alguem tem o mesmo problema, vou já colocar o codigo que fiz todos passos do exercicios com exatidão..e testei no meu proprio celular moto x Play android 6.0.1

<?xml version='1.0' encoding='utf-8'?>
<widget id="org.andrejrocha.garconapp" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>Garçonete Só de Cenoura</name>
    <description>
        App para uso das Garçonetes dentro do restaurante
    </description>
    <author email="qualquer@andrejrocha.org.co" href="http://andrejrocha.org.com">
       Andre
    </author>
    <preference name="Orientation" value="portrait" />
    <preference name="Fullscreen" value="false" />
    <preference name="DisallowOverscroll" value="true" />
    <preference name="BackgroundColor" value="0xF2F2f2FF" />
    <preference name="SplashScreen" value="screen" />
    <preference name="SplashScreenDelay" value="3000" />
    <platform name="android">
        <icon density="ldpi" src="resources\android\icon\drawable-ldpi-icon.png" />
        <icon density="mdpi" src="resources\android\icon\drawable-mdpi-icon.png" />
        <icon density="hdpi" src="resources\android\icon\drawable-hdpi-icon.png" />
        <icon density="xhdpi" src="resources\android\icon\drawable-xhdpi-icon.png" />
        <icon density="xxhdpi" src="resources\android\icon\drawable-xxhdpi-icon.png" />
        <icon density="xxxhdpi" src="resources\android\icon\drawable-xxxhdpi-icon.png" />
        <splash density="port-ldpi" src="resources\android\splash\drawable-port-ldpi-screen.png" />
        <splash density="port-mdpi" src="resources\android\splash\drawable-port-mdpi-screen.png" />
        <splash density="port-hdpi" src="resources\android\splash\drawable-port-hdpi-screen.png" />
        <splash density="port-xhdpi" src="resources\android\splash\drawable-port-xhdpi-screen.png" />
        <splash density="port-xxhdpi" src="resources\android\splash\drawable-port-xxhdpi-screen.png" />
        <splash density="port-xxxhdpi" src="resources\android\splash\drawable-port-xxxhdpi-screen.png" />
    </platform>
    <icon src="resources\android\icon\drawable-xhdpi-icon.png" />
    <plugin name="cordova-plugin-statusbar" spec="~2.1.3" />
    <platform name="android">
        <preference name="StatusBarBackgroundColor" value="#E86C13" />
    </platform>
    <plugin name="phonegap-plugin-barcodescanner" spec="~5.0.0" />
</widget>

<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta charset="utf-8">
    <title>Só de Cenoura Garçom</title>
    <link rel="stylesheet" href="icons/material.css">
    <link rel="stylesheet" href="css/materialize.min.css">
    <link rel="stylesheet"  type="text/css"  href="css/estilos.css">
</head>
<body>


    <div class="topo-fixo z-depth-1">
        <div class="yellow darken-4 white-text valign-wrapper">
            <h5 class="titulo">Só de Cenoura</h5>

            <div>
                <i class="material-icons waves-effect waves-light waves-circle scan-qrcode">camera</i>

                <i data-activates="submenu" data-gutter="5" data-contrainwidth="false"
                   class="material-icons waves-effect waves-light waves-circle dropdown-button">more_vert</i>

            </div>

            <ul class="dropdown-content" id="submenu">
                <li> <a class="black-text acao-limpar">Limpar</a></li>
            </ul>

        </div>    

        <ul class="tabs">
            <li class="tab yellow darken-4"><a href="#bolos" class="white-text waves-effect waves-light">Bolos</a></li>
            <li class="tab yellow darken-4"><a href="#bebidas" class="white-text waves-effect waves-light">Bebidas</a></li>
        </ul>

    </div>

    <div class="section" id="bolos">

        <h6 class="container brown-text">Em pedaços</h6>
        <div class="collection">
            <a class="collection-item waves-effect black-text">Só de Cenoura</a>
            <a class="collection-item waves-effect black-text">Com Nutella</a>
            <a class="collection-item waves-effect black-text">De Brigadeiro</a>
            <a class="collection-item waves-effect black-text">Acucarado</a>
        </div>

        <h6 class="container brown-text">Inteiro</h6>
        <div class="collection">
            <a class="collection-item waves-effect black-text">Só de Cenoura Inteiro</a>
            <a class="collection-item waves-effect black-text">Com Nutella Inteiro</a>
            <a class="collection-item waves-effect black-text">De Brigadeiro Inteiro</a>
            <a class="collection-item waves-effect black-text">Acucarado Inteiro</a>
        </div>

    </div>

    <div class="section" id="bebidas">

        <h6 class="container brown-text">Cafés</h6>
        <div class="collection">
            <a class="collection-item waves-effect black-text">Expresso</a>
            <a class="collection-item waves-effect black-text">Cappucino</a>
            <a class="collection-item waves-effect black-text">Mochattino</a>
        </div>


        <h6 class="container brown-text">Refrigerantes</h6>
        <div class="collection">
            <a class="collection-item waves-effect black-text">Coca</a>
            <a class="collection-item waves-effect black-text">Soda</a>
            <a class="collection-item waves-effect black-text">Guaraná</a>
        </div>

    </div>

    <div class="fixed-action-btn">
        <a href="#confirmacao" id="confirmar"
        class="btn-floating btn-large waves-effect
        waves-light red modal-trigger">
        <i class="material-icons">done</i>

        </a>
    </div>    

    <div class="modal modal-fixed-footer" id="confirmacao">
        <div class="modal-content">
            <h5>Resumo do pedido</h5>
            <input type="number" placeholder="Número da Mesa"  class="validate" id="numero-mesa" /> 

            <blockquote id="resumo"></blockquote>
        </div>
        <div class="modal-footer">
         <button class="btn deep-orange waves-effect waves-light modal-close">
         Pedir
        </button>

        <button class="acao-limpar btn-flat waves-effect waves-red modal-close">
         Cancelar
        </button>
        </div>
    </div>

    <script src="cordova.js"></script>
    <script src="js/jquery.min.js"></script>
    <script src="js/materialize.min.js"></script>
    <script src="js/app.js"></script>    
</body>
</html>
1 resposta
solução!

Erro de sintaxe no app.js, está correto e funcionamento OK

O instrutor colocar alguns "erros de sintaxe" para evitar que copiem e colem somente. Como faço junto com o video em geral nao copio...mas como não funcionou, fui copiar e percebi que esta com isso...então, olhem...

Olhem na explicação

$('.scan-qrcode').click(function(){
    cordova.plugins.barcodeScanner.scan(function(resultado));
    alert(resultado.text);
    });
});

mudem para

$('.scan-qrcode').click(function(){
    cordova.plugins.barcodeScanner.scan(function(resultado){
        alert(resultado.text);
    });
});