Skip to content

mirshahbazi/NFCSocketMAM

Repository files navigation

NFCSocket Build Status

Using with gradle

  • Add the JitPack repository to your root build.gradle:
repositories {
    maven { url "https://jitpack.io" }
}
  • Add the dependency to your sub build.gradle:
		dependencies {
	           implementation 'com.github.mirshahbazi:NFCSocketMAM:-SNAPSHOT'
	}

Using with maven

  • Add the JitPack repository to your build file
	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>
  • Add the dependency
 	<dependency>
   <groupId>com.github.mirshahbazi</groupId>
       <artifactId>NFCSocketMAM</artifactId>
       <version>-SNAPSHOT</version>
   </dependency>

NfcSocket is a lib for Android developers to implement communication via NFC in an easy way. Based on Host-card-emulator, NfcSocket implements P2P multi-rounds communication. But unlike Android Beam, NfcSocket allows devices communicating automatically without user intervention.

Main Features

  • Play Nfc communication in an easy way.
  • Multi-rounds P2P communication without user touch (comparing to Beam).
  • Handle incoming messages and make responses in own classes rather than HCE service.

Usage and Sample Code

An example is provided in Example folder.

Card-Side plays as Server Socket

  • import ('NFCSocketMAM') and all useful functions can be accessed in
NfcReciveSocket.getInstance()
  • ('xml/apduservice') decalres the AID group. More information about AID group selection can be found in HostApduService. ('xml/apduservice') in ('NfcSocketMAM') provides an example AID group. Note that if using custom AID group, you should override the corresponding methods in ('NfcSocket.Utils')\

Others

  • Currently all operations are conducted in main thread. The multi-thread operations will be supported later.

About

sample to send and receive data in Host-based card emulation NFC android

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages