Ionic NFC reading example
This is working example to read NFC tags in ionic application.
- Run
ionic cordova plugin add phonegap-nfc
- Run
npm install @ionic-native/nfc
- Add to app.module.ts NFC module:
import {NFC} from '@ionic-native/nfc/ngx';
@NgModule({
declarations: [AppComponent],
entryComponents: [],
imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule],
providers: [
StatusBar,
SplashScreen,
NFC,
{provide: RouteReuseStrategy, useClass: IonicRouteStrategy}
],
bootstrap: [AppComponent]
})
export class AppModule {
}
- Import NFC on platform-ready event and subscribe to nfc events (see
app.component.ts
)