How to Catch Device Serial in PHONEGAP?

Asked

Viewed 34 times

0

I need to get a phonegap. At the end of the URL I would like to add the device ID to see if it is already registered or not in the database. For sending I use the Ajax function of Jquery. Below follows the Code:

<script>
     window.onload =  function(){
                document.addEventListener('deviceready', iniciar);
                    function iniciar(){   
                        console.log('App Iniciado');
                        };

                    };

         $(document).ready(function(e){
            var a = device.serial;
              $.ajax({
                type: 'GET',
                url: "https://localhost/aulaphonegap/consulta.php?s="+a,  
                dataType:'json',
                timeout:5000,
                success: function(e){
                    if(e.Resp == 1){
                           console.log(e.Resp);

                         }else{
                            console.log("Segunda Opção");
                    }

                },
                error: function(e) {
                alert('Aviso!: ' + e.message);
                }
            })

          });       

  • from what I understand your code already picks up the serial you want to do the validation in the correct database?

  • Yeah, that’s right.

  • Your question "How to Catch Device Serial on PHONEGAP?" is no longer answered with the var a = device.serial;?

  • It didn’t work that way. Returns Empty

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.