locked
Making the QR code unique for each visit

    Question

  • Hi!

    Iam trying to develop an app for windows phone 8. I have an QR image that starts from number 1. Its on the page load so everytime u start the emulator u get the image code for number 1. I want to make each time I start the emulator that he starts on the number after so each visit get the next number. for ex the next time I start the emulator I should get the QR image for number 2 and so on. 

    Any advice on how to make this? Is it possible to save the Qr code to a local database and not the image?

    Thanks

    Joacke

    Wednesday, January 28, 2015 12:54 PM

Answers

  • Hi Joacke,

    Per my understanding, you can save the used number in local storage and read it next time. Code looks the following. Note you don’t mention how you generate that QR image, so I use a simple one. If you want to use the code snippet, you should modify to meet your requirement.

    private void Button_Click(object sender, RoutedEventArgs e)
    
            {
    
                QRCodeEncoder qrCodeEncoder = new QRCodeEncoder();
    
                int number = 1;
    
    
                //read from local storage to find the previous number
    
                var setting = Windows.Storage.ApplicationData.Current.LocalSettings;
    
                if (setting.Values.ContainsKey("QRCode"))
    
                {
    
                    number = (int)setting.Values["QRCode"];
    
                }else{
    
                    setting.Values.Add("QRCode",0);
    
                }
    
                
    
                Image image;
    
                String data = txtEncodeData.Text;
    
                image = qrCodeEncoder.Encode(number);
    
                picEncode.Image = image;
    
    
                setting.Values["QRCode"] = ++number;
    
            }
    

    If this doesn’t help, please post more information about your scenario.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.

    Thursday, January 29, 2015 6:27 AM
    Moderator