Back to project page MifareClassicTool.
The source code is released under:
GNU General Public License
If you think the Android project MifareClassicTool listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
/* * Copyright 2013 Gerhard Klostermeier// w w w.ja v a 2s. c om * * 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/>. */ package de.syss.MifareClassicTool.Activities; import android.app.Activity; import android.content.Intent; import de.syss.MifareClassicTool.Common; /** * An Activity implementing the NFC foreground dispatch system overwriting * onResume() and onPause(). New Intents will be treated as new Tags. * @see Common#enableNfcForegroundDispatch(Activity) * @see Common#disableNfcForegroundDispatch(Activity) * @see Common#treatAsNewTag(Intent, android.content.Context) * @author Gerhard Klostermeier * */ public abstract class BasicActivity extends Activity { /** * Enable NFC foreground dispatch system. * @see Common#disableNfcForegroundDispatch(Activity) */ @Override public void onResume() { super.onResume(); Common.enableNfcForegroundDispatch(this); } /** * Disable NFC foreground dispatch system. * @see Common#disableNfcForegroundDispatch(Activity) */ @Override public void onPause() { super.onPause(); Common.disableNfcForegroundDispatch(this); } /** * Handle new Intent as a new tag Intent and if the tag/device does not * support Mifare Classic, then run {@link TagInfoTool}. * @see Common#treatAsNewTag(Intent, android.content.Context) * @see TagInfoTool */ @Override public void onNewIntent(Intent intent) { int typeCheck = Common.treatAsNewTag(intent, this); if (typeCheck == -1 || typeCheck == -2) { // Device or tag does not support Mifare Classic. // Run the only thing that is possible: The tag info tool. Intent i = new Intent(this, TagInfoTool.class); startActivity(i); } } }