EddyVerbruggen / nativescript-nfc

:pencil: NativeScript plugin to discover, read, and write NFC tags
MIT License
84 stars 37 forks source link

Cannot find namespace 'android' #51

Closed Rav-Naz closed 4 years ago

Rav-Naz commented 4 years ago

after type in console tns run I'm getting this error:

ERROR in node_modules/nativescript-nfc/nfc.android.d.ts:3:18 - error TS2503: Cannot find namespace 'android'.

3     savedIntent: android.content.Intent;
                   ~~~~~~~
node_modules/nativescript-nfc/nfc.android.d.ts:11:22 - error TS2503: Cannot find namespace 'android'.

11     ndefToJSON(ndef: android.nfc.tech.Ndef): NfcNdefData;
                        ~~~~~~~
node_modules/nativescript-nfc/nfc.android.d.ts:12:28 - error TS2503: Cannot find namespace 'android'.

12     messageToJSON(message: android.nfc.NdefMessage): Array<NfcNdefRecord>;
                              ~~~~~~~
node_modules/nativescript-nfc/nfc.android.d.ts:13:26 - error TS2503: Cannot find namespace 'android'.

13     recordToJSON(record: android.nfc.NdefRecord): NfcNdefRecord;
                            ~~~~~~~

I'm working on Android Emulator, in Nativescript Angular

EddyVerbruggen commented 4 years ago

Thx for reporting. There are a few ways around this, but I think it's best to fix that in the plugin itself - give 4.1.0 a spin.

Rav-Naz commented 4 years ago

I'm fixed it by install tns-platform-declarations and added reference.d.ts on root folder. I'm suggest that you should add this infromation in readme.md.

śr., 6 lis 2019, 17:18 użytkownik Eddy Verbruggen notifications@github.com napisał:

Closed #51 https://github.com/EddyVerbruggen/nativescript-nfc/issues/51.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/EddyVerbruggen/nativescript-nfc/issues/51?email_source=notifications&email_token=AH2RYFWYORJUEGPZ4J5DNT3QSLU6BA5CNFSM4JJS7HYKYY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGOUV24ZCI#event-2775960713, or unsubscribe https://github.com/notifications/unsubscribe-auth/AH2RYFQLR7QLO5OHAOLEUW3QSLU6BANCNFSM4JJS7HYA .

EddyVerbruggen commented 4 years ago

That was what I could have said, but I did one better and fixed it in the plugin like I mentioned.

Rav-Naz commented 4 years ago

Hey, is there any way to enable NFC only in one component? Already it is enabled on whole application, and everytime I'm getting this information:

Ndef discovered, but no listener was set via setOnNdefDiscoveredListener.

I'm wish to use nfc only in components where I have listeners. Thanks for help in advance. Best regards, Rafał

śr., 6 lis 2019 o 18:37 Eddy Verbruggen notifications@github.com napisał(a):

That was what I could have said, but I did one better and fixed it in the plugin like I mentioned.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/EddyVerbruggen/nativescript-nfc/issues/51?email_source=notifications&email_token=AH2RYFUSOTVRANG4LUGZ6R3QSL6FTA5CNFSM4JJS7HYKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDHLXRI#issuecomment-550419397, or unsubscribe https://github.com/notifications/unsubscribe-auth/AH2RYFSOFJ2GRKGAMLSHV2DQSL6FTANCNFSM4JJS7HYA .

EddyVerbruggen commented 4 years ago

We can remove that console.log, if that helps. But please don't hijack other issues with unrelated questions.