mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-04-25 04:16:09 +08:00
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:
parent
85825c7b91
commit
57bbcdebfb
@ -19,7 +19,7 @@ import { Injectable } from '@angular/core';
|
|||||||
*
|
*
|
||||||
* this.androidPermissions.checkPermission(this.androidPermissions.PERMISSION.CAMERA).then(
|
* this.androidPermissions.checkPermission(this.androidPermissions.PERMISSION.CAMERA).then(
|
||||||
* success => console.log('Permission granted'),
|
* 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]);
|
* this.androidPermissions.requestPermissions([this.androidPermissions.PERMISSION.CAMERA, this.androidPermissions.PERMISSION.GET_ACCOUNTS]);
|
||||||
|
@ -23,8 +23,17 @@ declare let window: any;
|
|||||||
*
|
*
|
||||||
* ...
|
* ...
|
||||||
*
|
*
|
||||||
|
* 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');
|
* let message = this.ndef.textRecord('Hello world');
|
||||||
* this.nfc.share([message]).then(onSuccess).catch(onError);
|
* this.nfc.share([message]).then(onSuccess).catch(onError);
|
||||||
|
* });
|
||||||
*
|
*
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user