Giter Club home page Giter Club logo

android-canteen-balance's Introduction

Icon

android-canteen-balance

JitPack Build Status License

Helper library to read out the current balance of canteen cards using NFC.

Supports the following cards:

Dependency

android-canteen-balance is available on jitpack.io

Gradle dependency:

allprojects {
    repositories {
        maven { url 'https://jitpack.io' }
    }
}
dependencies {
    compile 'com.heinrichreimersoftware:android-canteen-balance:0.1.2'
}

How-To-Use

android-canteen-balance sends broadcasts whenever a card is detected.
You could either extend AbstractCardBalanceReceiver if you want to handle the card balance in the background or AbstractCardBalanceActivity if you need the data in an activity.

Option 1: Using AbstractCardBalanceActivity:

public class CardBalanceActivity extends AbstractCardBalanceActivity{
    @Override
    protected void onReceiveCardBalance(CardBalance balance) {
        //TODO do something with the balance
    }
}

Option 2: Using AbstractCardBalanceReceiver:

public class CardBalanceReceiver extends AbstractCardBalanceReceiver{
    @Override
    protected void onReceiveCardBalance(Context context, CardBalance balance) {
        //TODO do something with the balance
    }
}

Dynamically register an instance of this receiver:

Context.registerReceiver(receiver, new IntentFilter(CardBalance.ACTION_CARD_BALANCE))

Or statically publish an implementation in your AndroidManifest.xml:

<manifest ...>
    <application ...>
        <receiver android:name=".CardBalanceReceiver">
            <intent-filter>
                <action android:name="com.heinrichreimer.canteenbalance.action.CARD_BALANCE"/>
            </intent-filter>
        </receiver>
    </application>
</manifest>

Changes

See the releases section for detailed changelogs.

Open source libraries

android-canteen-balance is mainly based on MensaGuthaben by @Jakob Wenzel (GNU General Public License v3). It also uses some methods of Apache Commons Lang's ArrayUtils.java (Apache License 2.0).

Tested university cards

Map

License

Copyright (C) 2016 Heinrich Reimer

Authors:
Heinrich Reimer <[email protected]>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

android-canteen-balance's People

Contributors

janheinrichmerker avatar

Stargazers

Jan Birkert avatar Mæve Rey avatar Vishal Suresh Kesharwani avatar Florian avatar Asif Patel avatar Jan Meier avatar Sanjay Shyamal avatar  avatar Kay Förster avatar Gregory Goodnight avatar Wade avatar Roman Schlagowsky avatar

Watchers

James Cloos avatar  avatar  avatar

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.