Reputation: 1357
I have separated tsx
files: AppleTechRequest.tsx
for iPhone and AndroidTechRequest.tsx
for Android.
When I call the function on iOS:
const startTechRequest = () => {
NfcManager.requestTechnology([NfcTech.Ndef, NfcTech.NdefFormatable]).then(
(data: any) => {
NfcManager.getTag().then((tag: any) => {
console.log('Apple::Tag', tag);
});
},
);
};
And on Android I call:
const writeNdef = async () => {
try {
const message = 'Hello from S24 Ultra';
const record = Ndef.textRecord(message);
const bytes = Ndef.encodeMessage([record]);
console.log('Android::Requesting');
const tech = await NfcManager.requestTechnology(
[NfcTech.Ndef, NfcTech.NdefFormatable]
);
console.log('Android::Requested');
await NfcManager.ndefFormatableHandlerAndroid.formatNdef(bytes);
await NfcManager.ndefHandler.writeNdefMessage(bytes);
} catch (ex) {
console.log('Android::Write Ndef::Catch', ex);
} finally {
console.log('Android::Write Ndef::Finally');
}
};
There's the following behavior:
iPhone logs: Apple::Tag {}
Android logs: Android::Requesting
. it doesn't reach to the next log message
Upvotes: 0
Views: 99