Developing NFC Applications with Android

Developing NFC Applications with Android

NFC applications can be developed in the three NFC operating modes: – in the reader/writer mode, the NFC smartphone acts as an active initiator terminal (generating RF fields as power supply) to read and encode a passive target NFC tag; – the P2P mode allows communication between two NFC-enabled devices: they can exchange data by being both initiator and target in turn (in active/active or active/passive mode) thanks to the LLCP layer and its management of collisions; – in the card emulation mode, the passive NFC-enabled target device behaves as a smart card; in this specific mode, the smartphone can host one or several terminal applications executed in the host OS environment, which can act as the user interface and/or as intermediate application (proxy) to interface with a remote system, and one or several services executed in the SEs secure environment. http://codeshoppy.com/android-projects-titles-ieee.html  An NFC smartphone or tablet can act as a reader/encoder of NFC tags in the reader/writer mode. In the P2P mode, the smartphone can also exchange data with another NFC device. In the card emulation mode, the smartphone can act as a contactless NFC smart card (with a SE or an HCE service) to be “read” by an NFC reader. This chapter introduces mobile applications programming on the Android platform in the three NFC modes, including the HCE mode. NOTE.– In this chapter, we provide a brief introduction to Android application development with Eclipse. This requires basic knowledge in programming, and especially a good understanding of Java language.

2.1. Introduction to Android programming using Eclipse Several Integrated Development Environments (IDEs) enable Android application development (in native mode). Among the most commonly used free and open source software, the examples are EclipseTM1 that we will use with the Android Development Toolkit2 (ADT) plugin, IntelliJ IDEA from JetBrain used with the ideaAndroid plugin3 , Netbeans used with the basic NBAndroid plugin4 , etc. However, Google’s official and free IDE, which came out in 2013, is Android Studio5 : this IDE is based on the open source version technology of IntelliJ IDEA. Check here. A developer specialized in Android apps coding will rather use Android Studio.

2.1.1. Android in a nutshell Android is the open source operating system (based on a Linux kernel) published by Google. The runtime running Android applications is an optimized multi-task virtual machine for mobile devices (using low memory) called Dalvik. The programming language for Android applications is based on Java: once the Java classes are compiled in bytecode, they are converted into a “classes.dex” file to be interpreted and processed by Dalvik. The executable file is a compressed archive type of file (jar6 ) of “APK” (Android PacKage) extension. NOTE.– Any Android application runs in a dedicated memory area and is given a unique user ID (Linux user ID). Moreover, the files of a given Android application can only be seen (by default) by this application, which enhances security. More help. The AndroidManifest.xml declarations file (in XML format) is required to run the Android application: it stores the application package name, its version, the Android version compatibility, permissions to be granted by the user in order to use the features required by the application, declarations and Google API access keys (retrieved from Google developer’s console for Maps, Google Play, Street view, Google Cloud Messaging, Prediction, YouTube, etc.), all activities and filters on activities (for example to declare the main activity that will be executed at launch or an activity executed when detecting an NFC-enabled device). The best Android and PHP Project Titles for the college students. NOTE.– User interfaces and menus are also described into XML files.

2.1.1.1. Versions of Android Android versions are managed according to two levels: – Android version (OS installed on smartphones); – software development kit (SDK) number with which the application is compiled. Major Android versions are identified by a code name, whereas deployed and SDK versions are numbered.

2.1.1.2. Publishing Android apps on Google Play The Google Play Developer Console8 enables Android apps developers/providers to publish theirs apps (file extension “apk” of a maximum size of 50 MB) on the Google Play Store. For this, you must have a Google account and pay the one time registration fee (USD 25). On an indicative basis, the allowed price range for an Android application goes from USD 0.99 to USD 200 for a distribution on U.S. market according Google’s location pricing table9 . Transaction fees charged by Google are 30% of the application retail price.