-3

My app currently has the ability to use the camera to scan for QR codes. These QR codes will be sent via email. Hence, I would also like the app to have the ability to scan the phone display for QR codes also. Is that possible, and if yes, how can I do that?

I understand that I can have the user download the QR code attachment from the email and then upload it to the application, but I was looking for something more user friendly.

George
  • 389
  • 5
  • 17
  • Be more specific. What exactly have you tried? What doesn't work? Were Google search results not helpful, if not, why? Otherwise your question can be closed as too broad. – mentallurg May 24 '20 at 20:58
  • Does this answer your question? [Scanning QR code from screen](https://stackoverflow.com/questions/45298701/scanning-qr-code-from-screen) – Balastrong May 24 '20 at 20:58
  • @mentallurg So I have currently a third-party library that uses the camera to scan. I tried searching Google for scanning the phone's display, but ,Zxing's for example, need to have an image uploaded to it to work without the camera. That's not exactly what I need, as I don't want to have to store the QR code in storage, and then upload it again – George May 24 '20 at 21:18
  • @Balastrong I believe no, as it suggests to convert the image to a File, and then upload it to the app. – George May 24 '20 at 21:21

1 Answers1

1

I would discourage you from creating QR code based on screen image. By using screen you will do your task much more complex. The QR code on the screen can have semi-transparent background, or QR code is normally a small part of the screen and you would need to detect its borders and to cut it out, or there can be some visual effects specific for particular device and user settings.

Where as by using some a library you obtain a pure QR image, without any overhead.

Then, when creating an email, create an attachment from the byte stream of QR image.

mentallurg
  • 4,967
  • 5
  • 28
  • 36
  • Hi, I probably weren't clear on this, but I want to detect the QR code displayed on the screen (not generate it). The user will received a QR code generated from a library, and use that to log into my application. Or you meant, upload the QR code attached in the email, and create a byte stream from that, then sent the byte stream to a library which detects QR codes? – George May 25 '20 at 07:09
  • I meant that it is unneeded overhead to detect an image displayed on the screen. You will need a lot of efforts to detect what part of the screen contains the QR code, where is the border of QR code, you will need to cut it out. If there are some visual effects on the screen, you will need to filter them out. This al is unneeded, because you can just get an image of QR code directly from the library. I don't understand why you want to do a lot of unneeded efforts. – mentallurg May 25 '20 at 07:16
  • If the user receives the QR code to be scanned via email, I was thinking it would be better user experience if they opened the attached QR code and the app would immediately detect it. Otherwise, the user could download the QR code from the email, and then use a "Upload QR code from device folder" option to allow the app to scan the QR code within itself. – George May 25 '20 at 07:22
  • Then your question is totally misleading. You say your camera can scan QR codes. Then you say QR codes will be sent by Email. It sounds so that you want to scan QR codes by camera and send result per Email. What upload you now mean, it unclear. What does it have to do with downloads, is also unclear. – mentallurg May 25 '20 at 07:26
  • Yup, now that I'm reading it again, you are right. I will search a bit more into this and perhaps ask the same question again if needed - more detailed/coherent this time. – George May 25 '20 at 07:28