Giter Site home page Giter Site logo

titanium-barcode's Introduction

Barcode Scanner For Appcelerator Titanium

This is a small barcode scanner module you can use together with Titanium Appcelerator on an Android device.

Build prerequisites

To build the module, there are some dependencies which need to be fulfilled:

  • Git
  • Titanium Mobile SDK 1.8.1 or above
  • Python >= 2.5
  • Sun Java SDK 6.0
  • Android SDK with Google APIs and SDK version 4 installed
  • Ant >= 1.7.1

Build the module

To build the module, you need to clone our git repository and build the sources with ant:

# clone the repository
git clone https://github.com/mwaylabs/titanium-barcode.git
cd titanium-barcode
# run ant to build the module
ant clean && ant

If the build fails, make sure the entries in the buld.properies file point to the right path:

titanium.platform=/Library/Application Support/Titanium/mobilesdk/osx/1.8.1/android
android.platform=/opt/android-sdk/platforms/android-4
google.apis=/opt/android-sdk/add-ons/addon_google_apis_google_inc_4

The newly created *.jar and *.zip files can be found in the dist directory. The module you need is called com.mwaysolutions.barcode-android-$VERSION.zip

Use the module

  • Build the module or download is from the download section
  • Place it into your appcelerator project directory
  • Add the module to the module section of your tiapp.xml file: com.mwaysolutions.barcode
  • Use it in your application with require('com.mwaysolutions.barcode');
  • Build your project as usual with the Titanium Developer application

The Scanner looks strange on devices with a high resolution screen?!

If the layout of the scanner activity is not centered, add the following entry to your tiapp.xml:

<android xmlns:android="http://schemas.android.com/apk/res/android">
    <manifest>
      <supports-screens
        android:smallScreens="true"
        android:normalScreens="true"
        android:largeScreens="true"
        android:anyDensity="true" />
    </manifest>
</android>

Code Example

var window = Ti.UI.createWindow({
    backgroundColor:'white'
});

var label = Ti.UI.createLabel();
window.add(label);
window.open();

var titaniumBarcode = require('com.mwaysolutions.barcode');

titaniumBarcode.scan({
  success: function (data) {
    if(data && data.barcode) {
      var label = Titanium.UI.createLabel({
        text:'Barcode: ' + data.barcode,
        textAlign:'center',
        width:'auto'
      });
      win.add(label);
    } else {
      alert(JSON.stringify(data));
    }
  },

  error: function (err) { 
    alert("Error!! " + err); 
  },

  cancel: function () { 
    alert("cancel"); 
  }
});

titanium-barcode's People

Contributors

mwaysolutions avatar pfleidi avatar raducirstoiu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

titanium-barcode's Issues

Error when compiling.

change the build.properties:

titanium.platform=/Users/wilmerarteaga/Library/Application Support/Titanium/mobilesdk/osx/3.2.2.GA/module/android
android.platform=/Volumes/DATOS/programas/adt-bundle-mac-x86_64-20130219/sdk/platforms/android-4
google.apis=/Volumes/DATOS/programas/adt-bundle-mac-x86_64-20130219/sdk/add-ons/addon-google_apis-google-4

and says:

BUILD FAILED
/Volumes/DATOS/temp_titanium/titanium-barcode/build.xml:9: The following error occurred while executing this line:
/Users/wilmerarteaga/Library/Application Support/Titanium/mobilesdk/osx/3.2.2.GA/module/android/build.xml:98: taskdef class org.appcelerator.titanium.ant.StringTask cannot be found
using the classloader AntClassLoader[]

Thank you.

Module Compatibility for more Android devices

The timodule.xml was requiring AUTOFOCUS and FLASHLIGHT features that means some devices will be incompatible with this module, to solve this make autofocus and optional please.

Something like that:

<?xml version="1.0" encoding="UTF-8"?>
<ti:module xmlns:ti="http://ti.appcelerator.org"
    xmlns:android="http://schemas.android.com/apk/res/android">

    <android xmlns:android="http://schemas.android.com/apk/res/android">
        <manifest>
            <uses-permission android:name="android.permission.CAMERA" />
            <uses-feature android:name="android.hardware.camera" />
            <uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
            <uses-permission android:name="android.permission.FLASHLIGHT" />
            <uses-feature android:name="android.hardware.camera.flash" android:required="false" />

            <application>
                <activity android:name="com.mwaysolutions.barcode.TitaniumBarcodeActivity"
                    android:configChanges="keyboardHidden"
                    android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
            </application>
        </manifest>
    </android>

</ti:module>

abilities of the module

Hello, guys! I have 2 questions about this beautiful module.

  1. What kinds of barcodes i can scan with your module? i want scan QR-code, it's possible?
  2. Can i use overlay views as imageView on scan screen?

Module not supported by 2.1.3 RC

Hi,
I'm trying to use the barcode module with the latest 2.1.3 RC but I'm getting the following error:

[ERROR] The 'apiversion' for 'com.mwaysolutions.barcode' in the module manifest is not a valid value. Please use a version of the module that has an 'apiversion' value of 2 or greater set in it's manifest file

Inside the modules section (tiapp.xml GUI) it says:
The module "..." is not supported by TI SDK 2.1.3....

Any chance of updating the module?

Overlays

I have two questions - thanks for your module by the way it's fantastic and truly helpful!

Is it possible to remove the overlay altogether? The issue I'm having is that I'm using anyDensity=false and the overlay is zoomed in and off-center. Is there a way I can fix this in the source code, or is there an option to launch sans-overlay?

Thanks again!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.