Monday 1 June 2015

How to make QR code for android app and website

You can create QR code direct via online generator. its very simple. In web world their are many online generator, which you can use for create QR code in image mode.

How to make QR code for android app and website dynamically.

Dynamically generating a QR code with PHP.

What is QR Code? (Quick Response Code) is the trademark for a type of matrix barcode (or two-dimensional barcode).
QR codes are a popular type of two-dimensional barcode. They are also known as hardlinks or physical world hyperlinks. QR Codes store up to 4,296 alphanumeric characters of arbitrary text. This text can be anything, for example URL, contact information, a telephone number, even a poem! QR codes can be read by an optical device with the appropriate software. Such devices range from dedicated QR code readers to mobile phones.
A QR code consists of black modules (square dots) arranged in a square grid on a white background, which can be read by an imaging device (such as a camera) and processed using Reed–Solomon error correction until the image can be appropriately interpreted. The required data are then extracted from patterns present in both horizontal and vertical components of the image.


Generate QR code in php

You can generate QR code using QR Codes API

To use this , basically:
( https://chart.googleapis.com/chart?chs=300x300&cht=qr&chl=http%3A%2F%2Fwww.google.com%2F&choe=UTF-8 )
  • 300x300 is the size of the QR image you want to generate,
  • the chl is the url-encoded string you want to change into a QR code, and
  • the choe is the (optional) encoding.
The link, above, gives more detail, but to use it just have the src of an image point to the manipulated value, like so:

( <img src="https://chart.googleapis.com/chart?chs=300x300&cht=qr&chl=http%3A%2F%2Fwww.google.com%2F&choe=UTF-8" title="Link to Google.com" /> )


Demo:












To Learn More Please Click Here.

Video Tutorial for generating QR code

 


create qr code in android. qr code scanner example.


for create in android you need to ZXING library in your project.
We will call on the resources in this open apk library within our app, retrieving and processing the returned results.

How to use:
  • Create an Activity which implements onQRCodeReadListener, and let implements required methods
  • Make sure Activity orientation is PORTRAIT and give Camera permision in the manifest.xml
  • Add a "QRCodeReaderView" in the layout editor like you actually do with a button for example
 <com.dlazaro66.qrcodereaderview.QRCodeReaderView
        android:id="@+id/qrdecoderview"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
  • In your onCreate method, you can find the view as usual, using findViewById() function.
  • Set onQRCodeReadListener to the QRCodeReaderView.
  • Start & Stop camera preview in onPause() and onResume() overriden methods.
  • Use onQRCodeReadListener callbacks as you want.
  • You can place widgets or views over QRDecoderView
    public class DecoderActivity extends Activity implements OnQRCodeReadListener {

    private TextView myTextView;
    private QRCodeReaderView mydecoderview;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_decoder);

        mydecoderview = (QRCodeReaderView) findViewById(R.id.qrdecoderview);
        mydecoderview.setOnQRCodeReadListener(this);

        myTextView = (TextView) findViewById(R.id.exampleTextView);
    }


    // Called when a QR is decoded
    // "text" : the text encoded in QR
    // "points" : points where QR control points are placed
    @Override
    public void onQRCodeRead(String text, PointF[] points) {
        myTextView.setText(text);
    }


    // Called when your device have no camera
    @Override
    public void cameraNotFound() {

    }

    // Called when there's no QR codes in the camera preview image
    @Override
    public void QRCodeNotFoundOnCamImage() {

    }

    @Override
    protected void onResume() {
        super.onResume();
        mydecoderview.getCameraManager().startPreview();
    }

    @Override
    protected void onPause() {
        super.onPause();
        mydecoderview.getCameraManager().stopPreview();
    }
}

Add it to your project

Add QRCodeReaderView dependency to your build.gradle
dependencies{
    compile 'com.dlazaro66.qrcodereaderview:qrcodereaderview:1.0.0'
}


download full source code for qr code generator here:

QR CODE GENERATOR 

 Click this link for Eclipse Project EXAMPLE FOR QR CODE its very useful.





 

No comments:

Post a Comment