- 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'
}
- 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.
- 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.
An example is provided in Example folder.
- 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')\
- Currently all operations are conducted in main thread. The multi-thread operations will be supported later.