Thanks Klaus, I suppose the name threw me off. "Nah I don't need to read barcodes" ...lol Thank you.
Mike, thank you for confirming that it works fine on iOS.... Very thoughtful of you to include some code. I will rewrite it for my customer, but this saved me lots of time thank you. Mark this one [solved]. YES. MergeAV and Android barcode scanner., code sample included. On Sat, Feb 19, 2022 at 11:52 AM Mike Kerner via use-livecode < use-livecode@lists.runrev.com> wrote: > for ios use mergav. it works great > on ios when prompted, the user has to permit both the camera and the > microphone. > > > here's some code to help get you going > check for typos, i had to modify mine to make it more generic > > on scanCredentials > global barcodeTarget > if not(barcodePermissionsGranted()) then exit scanCredentials > put the long name of me into barcodeTarget > barcodeScannerStart "org.iso.QRCode" #when we get something back, > scanReturned will be called > unlock screen > end scanCredentials > > > > function barcodePermissionsGranted > global videoAccessGranted, audioAccessGranted > put empty into videoAccessGranted > put empty into audioAccessGranted > #get permission for the camera and microphone > if the environment is not "mobile" then return false > mergavrequestmediaaccess "video" > mergavrequestmediaaccess "audio" > repeat until videoAccessGranted is not empty and audioAccessGranted is > not empty # sit until we get the answers we seek > wait 10 milliseconds with messages > end repeat #until videoAccessGranted is not empty and audioAccessGranted > is not empty > return videoaccessGranted and audioaccessgranted > end barcodePermissionsGranted > > > > on barcodeScannerStart symbology > if the environment is not "mobile" then exit barcodeScannerStart > mobileBusyIndicatorStart "square","Starting Scanner",70 > wait 10 milliseconds with messages > put mergAVCamBarcodeTypes() into supportedSymbologies > if symbology is empty or symbology is "All" then > put supportedSymbologies into symbology #allow everything. > else if symbology is not in supportedSymbologies then #if it's empty > then assume "All" > beep > answer "The app wants to use a barcode symbology that isn't supported > "&symbology&"." > exit barcodeScannerStart > end if #symbology is not in supportedSymbologies > barcodeScanner symbology > end barcodeScannerStart > > > > on mergAVMediaAccess pType, pGranted > global videoAccessGranted, audioAccessGranted > if not pGranted then > if pType is "audio" then > put "microphone" into device > put "Microphone" into panel > else #video > put "camera" into device > put "Camera" into panel > end if #pType is "audio" > mobilebusyindicatorstop > put false into videoAccessGranted # nuke both because proceeding is > out. > put false into audioAccessGranted # nuke both because proceeding is > out. > answer "Please grant access to the"&&device&&"in the Settings app, > under Privacy ->"&&panel > exit to top > else #granted - only set the one that was granted, don't do any funky > resets, or anything. > if pType is "audio" then > put true into audioAccessGranted > else #video > put true into videoAccessGranted > end if #pType is "audio" > # added and removed...if audioAccessGranted and videoAccessGranted > then barcodeScanner symbology > end if #not pGranted > end mergAVMediaAccess > > > > on barcodeScanner symbology > global barcodeScannerIsLive > mobileBusyIndicatorStart "square","Starting Scanner",70 > mergavcamcreate > put the result into theResult > if theResult is not empty then > mobileBusyIndicatorStop > answer "Scanner not created:"&&theResult > exit barcodeScanner > end if #the result is not empty > try > mergAVCamSet "rect",the rect of grc "cam" > catch e > mobileBusyIndicatorStop > answer e > exit barcodeScanner > end try > try > mergAVCamSet "visible","true" > catch e > mobileBusyIndicatorStop > answer e > exit barcodeScanner > end try > try > mergAVCamSet "quality","high" > catch e > mobileBusyIndicatorStop > answer e > exit barcodeScanner > end try > mobileBusyIndicatorStop > > put mergavcamget("max zoom") into theZoom > try > mergavcamset "zoom",theZoom > catch e > mobileBusyIndicatorStop > answer e > exit barcodeScanner > end try > mergAVCamStartBarcodeReader symbology > put true into barcodeScannerIsLive > end barcodeScanner > > > > on mergAVCamBarcodeFound pBarcode, pType > global barcodeTarget > dispatch "scanReturned" to barcodeTarget with pBarcode > end mergAVCamBarcodeFound > > > > on stopBarcodeScanner > global barcodeScannerIsLive > if not barcodeScannerIsLive then exit stopBarcodeScanner # or will throw > an error > mergAVCamStopBarcodeReader > mergAVCamDelete > put false into barcodeScannerIsLive > end stopBarcodeScanner > > On Sat, Feb 19, 2022 at 11:05 AM Klaus major-k via use-livecode < > use-livecode@lists.runrev.com> wrote: > > > Hi Tom, > > > > > Am 19.02.2022 um 17:00 schrieb Tom Glod via use-livecode < > > use-livecode@lists.runrev.com>: > > > > > > Hi Folks, > > > > > > I've done some searches and its still not clear to me, a lot of old > posts > > > and no clear answer that I found that I can be sure applies in 2022. > > > > > > Do we have a working QR code reader library. widget, external? > > > For android? ios? > > > I don't mind paying for it. > > > > > > I know for desktop I can probably use the browser widget with the > camera, > > > and some JS library. > > > But has anyone successfully integrated a reader into a mobile app? > > > > yes, check "Android Barcode Library" in the dictionary. > > Works fine on Android, no idea about iOS, sorry. > > But maybe some of the MERGEXT... externals will do the job. > > > > > Thanks, > > > > > > Tom > > > > Best > > > > Klaus > > > > -- > > Klaus Major > > https://www.major-k.de > > https://www.major-k.de/bass > > kl...@major-k.de > > > > > > _______________________________________________ > > use-livecode mailing list > > use-livecode@lists.runrev.com > > Please visit this url to subscribe, unsubscribe and manage your > > subscription preferences: > > http://lists.runrev.com/mailman/listinfo/use-livecode > > > > > -- > On the first day, God created the heavens and the Earth > On the second day, God created the oceans. > On the third day, God put the animals on hold for a few hours, > and did a little diving. > And God said, "This is good." > _______________________________________________ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode > _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode