NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: ViggoPoulsen on July 25, 2012, 02:22:10 AM

Title: Can you identify the smartphone ?
Post by: ViggoPoulsen on July 25, 2012, 02:22:10 AM
Hi
I am working on an app ment for Smartphones ( as _mobile_ ).
You start up by scanning a QR code containing the IP address.
What I need is to get some kind of ID from the smartphone scanning the QR code. The ID can not come from the QR code but must be some kind of ID from the smartphone or from the browser that opens on the clients smartphone. Is there any kind of parameter I can use here ?

Best regards
Viggo Poulsen
Title: Re: Can you identify the smartphone ?
Post by: terryd on July 25, 2012, 02:49:22 AM
Viggo
I don't know if you have access to it but the first 8 or sometimes 10 characters of the IMEI number uniquely identifies the phone (manually on the phone is *#06#)
Not sure if this helps.
There is a website with a subscription system which publishes a csv database of cellphones and their unique IMEI numbers. If this will help I will send you the link.
Title: Re: Can you identify the smartphone ?
Post by: Bruce on July 25, 2012, 03:25:46 AM
Viggo,

By "Id" you mean a unique id for the phone itself? Not the _browser_ id (eg iOS, android etc.)?

So Bruce has phone number 1, Bill has phone number 2 and so on?

Cheers
Bruce
Title: Re: Can you identify the smartphone ?
Post by: ViggoPoulsen on July 25, 2012, 03:39:54 AM
Hi

Thank you for your answer.

Terry:
It's not so importand with the official owner of the smartphone, as long as I can detect some ID from the smartphone in my NT web app.
It will be used to separate administrator and user without the need of a login. Only smartphones marked as Admin in a DB will be allowed surtain functions. I do not want the normal users to see a login screen, they should automatically be sent to the correct page.

Bruce:
It is a unique ID for the phone. The browser ID is only usefull if it is unique pr. user.

Bruce=1 Bill=2  Viggo=3  Everyone else = 0
Imagine a QR code to put on a book. The user scanns the QR code at get the infor you want them to have (from a DB on the server). When Bruce scans the same qr code, he gets a menu with f.ex. possibility to match this QR code wit a specific book. Great when receiving new books, and the normal user is not bothered with a login.

Best regards
Viggo Poulsen
Title: Re: Can you identify the smartphone ?
Post by: bshields on July 25, 2012, 04:05:18 AM
Hi Viggo,

If your phones support HTML5 (which is most smart phones nowadays). You can use the HTML5 database feature (localstorage) to save persistant data to do various things.

You can check for the existence of a variable value (its a bit like a cookie value, bit works on iPhones when your web app has its URL saved on the homescreen).

<script>
if (('localStorage' in window) && window.localStorage !== null){

  localStorage.myspecialvariable = 'somespecialid';                  //set the special value with a literal
  localStorage.myspecialvariable = '<!--Net:s:mysepcialvalue -->';   //set the special value with a session value

}
</script>


Getting the value from HTML5s localStorage into NT is a little tricker. But lots of techniques exist.

<script>
  window.location = '/MainMenu?specialvalue='+localStorage.myspecialvariable;
</script>


or

<script>
  <a onClick="window.location = '/MainMenu?specialvalue='+localStorage.myspecialvariable;">Press Me</a>
</script>


or

<form>
  <input type='hidden' name='passedvalue' id='passedvalue' />
</form>
<script>
  document.getElementById('passedvalue').value=localStorage.myspecialvariable;
</script>


These snippets of HTML5 and JS can be injected into your pages via the XHTML tab inside nettalk.

Regards
Bill
Title: Re: Can you identify the smartphone ?
Post by: ViggoPoulsen on July 25, 2012, 07:13:11 AM
Hi Bill

That was new stuff for me ( many thing is when it comes to mobile apps ). I'll try and see if it can be used here.

Best regards
Viggo Poulsen