Helper library to read out the current balance of canteen cards using NFC.
Supports the following cards:
- InterCard
- Ximedes (formerly MagnaCarta) (Full list of tested universities at the bottom of the page.)
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'
}
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>
See the releases section for detailed changelogs.
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).
- Otto-Friedrich-Universität Bamberg
- Universität Bayreuth (only print-/copy-balance visible)
- Universität Bielefeld (only newer cards)
- Ruhr-Universität Bochum (only newer cards)
- Technische Universität Braunschweig
- Universität Bremen
- Technische Universität Clausthal
- Technische Universität Darmstadt
- Hochschule Darmstadt
- Technische Universität Dresden
- Martin-Luther-Universität Halle-Wittenberg
- Hochschule Hannover
- Ruprecht-Karls-Universität Heidelberg
- Technische Universität Ilmenau
- Hochschule Koblenz
- Rheinische Fachhochschule Köln
- Universität zu Köln
- Universität Konstanz
- Hochschule Konstanz Technik, Wirtschaft und Gestaltung
- Universität Leipzig
- Hochschule Osnabrück
- Universität Osnabrück
- Hasso-Plattner-Institut Potsdam
- Universität Potsdam
- Universität Stuttgart
- Julius-Maximilians-Universität Würzburg
- Hochschule Zittau/Görlitz
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/>.