Orandex / tibar

Automatically exported from code.google.com/p/tibar
0 stars 0 forks source link

Loading URL from scanned QR code #17

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The problem description:
Hi guys, sorry this may be a daft question but I have this working perfectly 
(me being very new to all this as well!) but how do you get the scanned URL to 
open up in Safari on the phone rather than an alert box? Also, is there a way 
to get the app to automatically detect the QR code and scan it automatically 
rather than it being a manual 'click' process? Much appreciated.

What version of the product are you using? On what operating system?
Titanium Mobile SDK: 1.5.1
Titanium Developer: 1.2.2
XCode: 3.2.5
iOS: 4.2
iPhone: 3GS

Original issue reported on code.google.com by andywhit...@gmail.com on 25 Feb 2011 at 10:32

GoogleCodeExporter commented 9 years ago
create a webview in the success callback function after scanning, set 
sourceType to ZBarReaderViewController and it should scan automatically 

Original comment by bhuenefe...@gmail.com on 19 Mar 2011 at 5:27

GoogleCodeExporter commented 9 years ago
any chance of charing some code in doing this? (adding a webview in the succes 
callback function)

Thanks!

Original comment by willae...@gmail.com on 3 Apr 2011 at 10:01

GoogleCodeExporter commented 9 years ago
You really should run the url through a regex to make sure it's what you need 
first but the error function will catch the issue and the page just won't load 
unless the url is of correct format.

success: function(data) {
                if(data && data.barcode) {
                    if(data.symbology == "QR-Code") {
                        var webView = Ti.UI.createWebView({
                            url: data.barcode 
                        }).show();
                        webView.addEventListener('error', function(e) {
                            Ti.API.error(e.message); 
                        });
                    }
                }
            }

Original comment by bhuenefe...@gmail.com on 3 Apr 2011 at 9:45

GoogleCodeExporter commented 9 years ago
Hi, thanks for sharing the code, however, i can't get this to work. I get a 
parse error....

any ideas?

Original comment by willae...@gmail.com on 29 Apr 2011 at 11:31

GoogleCodeExporter commented 9 years ago
what's the error you get?

Original comment by bhuenefe...@gmail.com on 29 Apr 2011 at 6:56