0

I am working on a project, in this project I am building an android app. the app will display a menu to the user where the user can pick some simple option. basically the idea is to have a coffee menu where the user can choose the type of the coffee, choose if he/she wants sugar and or creamer. I am thinking to have a QR code generated by the set of selection. for example "colombian coffee, with sugar no creamer" will generate QR code number 1. I have a coffee machine that will scan that QR code that was generated by the app, and then make the coffee and pour it to a cup. I am not really familiar with the QR code, and I am not sure if it is the correct way to do what I am trying to achieve which is "an automated coffee machine". are these QR codes need to be predefined some where ? and then based on the user selection, it look up and find which QR code that matches that selection. and then the coffee scanner will just scan that and make the coffee. is this possible and if so can some please tell me how these QR code are being generated? and how are being scanned? do I need to store them like "images " in a data base some where? thanks

BigFish
  • 87
  • 9
  • Your question doesn't really fit here (see [ask]), but to give you some help nonetheless: Have a look at [zxing](https://github.com/zxing/zxing/wiki/Getting-Started-Developing). It generates QR codes (images) on the fly from your given input (strings). And no, don't store the images in the DB. – PerlDuck Mar 20 '16 at 18:10
  • Possible duplicate: http://stackoverflow.com/questions/8800919/how-to-generate-a-qr-code-for-an-android-application in this post a qr-code library is suggested for creating. – Sunny Onesotrue Mar 20 '16 at 18:13

1 Answers1

0
   public async Task<string> ScanQR()
        {
            Activity context = Forms.Context as Activity;
            try
            {
                var options = new MobileBarcodeScanningOptions
                {
                    AutoRotate = true,
                    UseFrontCameraIfAvailable = false,
                    TryHarder = false,


                };
                var scanner = new ZXing.Mobile.MobileBarcodeScanner();
                scanner.UseCustomOverlay = false;
                scanner.TopText = "Scanning for QR Code";
                var result = await scanner.Scan(context, options);
                string a = result.Text.Trim();

                return a;

            }
            catch (Exception e)
            {
                return "Not Found";
            }


        }
  • You appear to use Xamarin. The Question, on the other hand, is tagged [tag:java]. Thus, your answer does not really match. Furthermore, an answer should not contain only code but also explain. – mkl Feb 14 '17 at 07:27