locked
My xamarin android app consumes more memory because of using QR code scanner, how to solve this...?? RRS feed

  • Question

  • User370415 posted

    Hi guys, I have developed an xamarin android app, it consists of QR code scanner. While I use to scan the QR code, My app consumes more memory because of launching the camera again and again..........how to solve this......???.........Plz share your solution....!!!

    Tuesday, July 3, 2018 10:54 AM

All replies

  • User355640 posted

    Hi @KavinRam

    Have you release the camera correctly if you don't need it in your app? Would you like share some logs about your app?

    Thursday, July 5, 2018 1:59 AM
  • User370415 posted

    hi @robbit
    Have you release the camera correctly if you don't need it in your app? Would you like share some logs about your app?

    I am using ZXing.Net.Mobile for scanning the QR code, So I am not sure whether the camera is released correctly or not..?...but I have made the object null after scanning the code and also I have checked in the xamarin profiler the memory gets increased while launching QRcode scanner

    Here is the code

    public void QRcode()
    {               
                   var scanner = new ZXing.Mobile.MobileBarcodeScanner(this.Activity);
                    scanner.TopText = "Scanning for QR code";
                    scanner.AutoFocus();
                    var result = await scanner.Scan();
                    if (result != null)
                    {
                        string QRvalue=result.Text;
                    }
                    scanner = null;
    }
    
    Thursday, July 5, 2018 6:13 AM
  • User327754 posted

    @KavinRam said: Hi guys, I have developed an xamarin android app, it consists of QR code scanner. While I use to scan the QR code, My app consumes more memory because of launching the camera again and again..........how to solve this......???.........Plz share your solution....!!!

    Hi, Follow this article this maybe help you.

    https://c-sharpcorner.com/article/xamarin-android-qr-code-reader-by-mobile-camera/

    Friday, July 6, 2018 10:34 AM