erich.wanker Posted October 8, 2020 Posted October 8, 2020 Hello, if my unigui app is running in Android Chrome Browser - it calls the barcodescanner-app - and the barcodescanner-app goes back to the chrome-browser...EVERYTHING works fine ! if the same unigui app is installed as PWA - the barcodescanner-app starts the Chromebrowser with the url of my app - and does not go back to the PWA I USE : i found following solution here in the forum to scann a barcode: 1. install https://play.google.com/store/apps/details?id=com.geekslab.qrbarcodescanner.pro&hl=en 2. create a unigui app -> create a button -> Clientevent -> extevent -> function click(sender, e, eOpts) { getScan(); } and include following code in Mainfor,script: function zxinglistener(e){ localStorage["zxingbarcode"] = ""; if(e.url.split("\#")[0] == window.location.href){ window.focus(); processBarcode(decodeURIComponent(e.newValue)); } window.removeEventListener("storage", zxinglistener, false); } if(window.location.hash != ""){ localStorage["zxingbarcode"] = window.location.hash.substr(1); self.close(); window.location.href="about:blank";//In case self.close is disabled }else{ window.addEventListener("hashchange", function(e){ window.removeEventListener("storage", zxinglistener, false); var hash = window.location.hash.substr(1); if (hash != "") { window.location.hash = ""; processBarcode(decodeURIComponent(hash)); } }, false); } function getScan(){ var href = window.location.href.split("\#")[0]; window.addEventListener("storage", zxinglistener, false); zxingWindow = window.open("zxing://scan/?ret=" + encodeURIComponent(href + "#{CODE}"),'_self'); } function processBarcode(b){ ajaxRequest(MainForm.form,"BARCODE",["value="+b]); } and to display the result: procedure TMainForm.UniFormAjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); if EventName = 'BARCODE' then mainform.nachricht_click('EAN oder QR Code:' + Params.Values['value']); Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.