Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If the zxing barcode scanner is installed in the mobile, its very easy:</p> <pre><code>Intent intent = new Intent( "com.google.zxing.client.android.SCAN"); intent.putExtra("SCAN_MODE", "PRODUCT_MODE");//for Qr code, its "QR_CODE_MODE" instead of "PRODUCT_MODE" intent.putExtra("SAVE_HISTORY", false);//this stops saving ur barcode in barcode scanner app's history startActivityForResult(intent, 0); </code></pre> <p>and in <code>OnActivityResult</code>:</p> <pre><code>@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { // TODO Auto-generated method stub super.onActivityResult(requestCode, resultCode, data); if (requestCode == 0) { if (resultCode == RESULT_OK) { String contents = data.getStringExtra("SCAN_RESULT"); //this is the result } else if (resultCode == RESULT_CANCELED) { // Handle cancel } </code></pre> <p>If its not installed: u can put this code in try-catch block and catching the exception, u can do this:</p> <pre><code>Uri marketUri = Uri .parse("market://details?id=com.google.zxing.client.android"); Intent marketIntent = new Intent(Intent.ACTION_VIEW, marketUri); startActivity(marketIntent); </code></pre> <p>So it redirects the app to android market and ur app continues running once if the barcode scanner is installed.</p> <p>If u dont want to use the other app in ur app, U have to download zxing library and try using the classes from core.jar file(it is created using apache ant). Follow this tutorial to do that: <code>http://code.google.com/p/zxing/wiki/GettingStarted</code></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload