Page 1 of 1

MergAVCam for Android

Posted: Tue Jan 01, 2019 1:45 am
by allengwinn
Ok guys. What would it take to incentivize somebody doing an external for barcode/QR reading on Android devices? Or, alternatively, can Monte share the source he's already worked on for ZXing Android and I will build it this semester? Fair warning: I have never built an external for Livecode but I am willing to learn! .... Which should scare you. I'm deficient in other ways as well :)

Allen

Re: MergAVCam for Android

Posted: Sun Jan 06, 2019 9:35 pm
by Peter@multidesk.se
Allen,

Have you used MergAvCam?

if not!

install "Barcode Scanner" (ZXing) on your android device.

Extract and copy this file into your project copy files pane..
AndroidQR.lcext.zip
(32.94 KiB) Downloaded 238 times

Code: Select all

on openCard
mergAVRequestMediaAccess "video"
end openCard
Start reading barcode:

Code: Select all

On StartReadQR
mergAVCamSet "visible","true"
      mergAVCamStartBarcodeReader
end StartReadQR
When a barcode is found:

Code: Select all

on mergAVCamBarcodeFound pBarcode, pBarcodeType
answer pBarcode
end mergAVCamBarcodeFound
Stop reading barcode:

Code: Select all

on StopReadQR
mergAVCamStopBarcodeReader
end StopReadQR

The biggest problem is that unless you have "Barcode Scanner" installed, the app will crash when you try to use this.
I have solved this by requesting a confirmation that "Barcode Scanner" is installed on the device (the first time it is to be used) and then saving the answer so that the question is not asked each time.


If you already knew about this, someone else might benefit from my answer :D

Good luck with your project



///Peter

Re: MergAVCam for Android

Posted: Mon Jan 07, 2019 3:32 pm
by allengwinn
Hi Peter.... this one "https://play.google.com/store/apps/deta ... d&hl=en_US" ???

I'll play around with it. So it's interface is just calling the sam MergAVCam stuff you call for iOS?

No, I haven't played with it yet but I will!!!

Thanks.

Re: MergAVCam for Android

Posted: Mon Jan 07, 2019 7:04 pm
by Peter@multidesk.se
Allen,

I have to try to keep myself sober during working hours :wink:

Forget about everything I mentioned earlier.

Yes, Install: https://play.google.com/store/apps/deta ... nt.android
Yes, Copy file AndroidQR.lcext into your projects copy files pane..

Then use:

Code: Select all

 put mergZXingGetBarcode() into tResult
I was terribly stressed when I wrote the previous reply and didn't think .... :oops:

Sorry!


///Peter

Re: MergAVCam for Android

Posted: Mon Jan 07, 2019 7:52 pm
by allengwinn
Quite alright! How do you confirm that the barcode app is installed? Is there an "exists" something?

Re: MergAVCam for Android

Posted: Mon Jan 07, 2019 8:26 pm
by Peter@multidesk.se
No, unfortunately,
The biggest problem is that unless you have "Barcode Scanner" installed, the app will crash when you try to use this.
I have solved this by requesting a confirmation that "Barcode Scanner" is installed on the device (the first time it is to be used) and then saving the answer so that the question is not asked each time.
I've used something like this:

Code: Select all

on checkScanInstall
   answer "To use this feature..." & cr & cr & "Confirm that you have installed the app" && QUOTE & "Barcode Scanner" & QUOTE && "from Google Play..." & cr & cr \
         & "if not, follow the link above for installation!" with "Cansel" or "I confirm!"
   if it is "Cansel" 
   then 
      exit to top
   else
      set the defaultFolder to specialFolderPath("documents")
      put  true into  URL ("file:ScannerInstall.txt")
   end if
end checkScanInstall

///Peter

Re: MergAVCam for Android

Posted: Mon Jan 07, 2019 8:37 pm
by allengwinn
Yeah, the only way I could immediately think of it is to possibly put some sort of a file in the media directory. But that would be risky. Your way is better.

Re: MergAVCam for Android

Posted: Mon Jan 07, 2019 8:40 pm
by allengwinn
Oh, if you have access to the source, you might be able to confirm that the thing launched successfully. But it would likely have to be done in the external itself. Disclaimer: I've never written an external. Come to think of it, this is my first app in Livecode :)

Re: MergAVCam for Android

Posted: Mon Jan 07, 2019 9:19 pm
by jacque
Peter@multidesk.se wrote:
Mon Jan 07, 2019 7:04 pm
Yes, Install: https://play.google.com/store/apps/deta ... nt.android
Yes, Copy file AndroidQR.lcext into your projects copy files pane..

Then use:

Code: Select all

 put mergZXingGetBarcode() into tResult
I don't see mergZXing in the inclusions pane, nor in the dictionary. Was it discontinued? Also, so far, I don't see any "merg" externals that are compatible with Android yet. This is a source of dismay to many of us. :(

Re: MergAVCam for Android

Posted: Mon Jan 07, 2019 9:51 pm
by Peter@multidesk.se
Jacqueline,

Unfortunately there is no official "merge" barcode external for Android. but this one works pretty well ...


///Peter

Re: MergAVCam for Android

Posted: Mon Jan 07, 2019 10:42 pm
by allengwinn
Peter, sorry but do you know if there is some test code that will scan a QR code using mergAVCam as it exists today?

Re: MergAVCam for Android

Posted: Mon Jan 07, 2019 10:46 pm
by Peter@multidesk.se
Have you encountered any problem, what do you need?

Re: MergAVCam for Android

Posted: Mon Jan 07, 2019 10:59 pm
by allengwinn
I found some sample code from Monte. I'll try to work it into an iOS app just to see if I can scan a code and make the results pop up on a card somewhere. I'm still at the playing around stage. Now what I'd really like is something cross-platform to do NFC or BLE :)

Re: MergAVCam for Android

Posted: Mon Jan 07, 2019 11:31 pm
by Peter@multidesk.se
Allen,

Here is a simple sample stack with everything you need...
ScanDemo.livecode.zip
(1.84 KiB) Downloaded 315 times

///Peter

Re: MergAVCam for Android

Posted: Thu Jan 10, 2019 1:53 pm
by mrcoollion
For Android maybe someone can wrap these Android API's for use in LC?

https://developers.google.com/vision/introduction
For Android Barcode Reader this video might be interesting.
https://www.youtube.com/watch?v=amMtAS2 ... kr&index=2

Regards,

Paul