docs(nfc): update usage doc of the nfc plugin (#1846)

* docs(nfc): update usage doc of the nfc plugin

show an example of how the event listeners work with observable subscription and implement an nfc share within the event listener.

* docs(AndroidPermissions): requestPermissions->requestPermission
This commit is contained in:
foysal 2017-08-24 01:37:31 +02:00 committed by Ibby Hadeed
parent 85825c7b91
commit 57bbcdebfb
2 changed files with 12 additions and 3 deletions

View File

@ -19,7 +19,7 @@ import { Injectable } from '@angular/core';
*
* this.androidPermissions.checkPermission(this.androidPermissions.PERMISSION.CAMERA).then(
* success => console.log('Permission granted'),
* err => this.androidPermissions.requestPermissions(this.androidPermissions.PERMISSION.CAMERA)
* err => this.androidPermissions.requestPermission(this.androidPermissions.PERMISSION.CAMERA)
* );
*
* this.androidPermissions.requestPermissions([this.androidPermissions.PERMISSION.CAMERA, this.androidPermissions.PERMISSION.GET_ACCOUNTS]);

View File

@ -23,8 +23,17 @@ declare let window: any;
*
* ...
*
* let message = this.ndef.textRecord('Hello world');
* this.nfc.share([message]).then(onSuccess).catch(onError);
* this.nfc.addNdefListener(() => {
* console.log('successfully attached ndef listener');
* }, (err) => {
* console.log('error attaching ndef listener', err);
* }).subscribe((event) => {
* console.log('received ndef message. the tag contains: ', event.tag);
* console.log('decoded tag id', this.nfc.bytesToHexString(event.tag.id));
*
* let message = this.ndef.textRecord('Hello world');
* this.nfc.share([message]).then(onSuccess).catch(onError);
* });
*
* ```
*/