Giter VIP home page Giter VIP logo

Comments (6)

whitedogg13 avatar whitedogg13 commented on August 20, 2024

Hi, thanks for adapting this library!

Regarding this issue, do you mean that you cannot see the exact ndef message you just write?

from react-native-nfc-manager.

jstansbe avatar jstansbe commented on August 20, 2024

My assumptions are that what is typed in the write textInput (google.com by default) is encoded in NDEF and sent out to listening devices. That is the info that isn't in the payload... unless im missing something?

from react-native-nfc-manager.

whitedogg13 avatar whitedogg13 commented on August 20, 2024

Sorry to come back so late. However I cannot reproduce this issue, can you provide more information?

from react-native-nfc-manager.

jstansbe avatar jstansbe commented on August 20, 2024

Here is some of the code:

                    <View style={{width: '100%',padding: 10, marginTop: 20, borderWidth: 1, borderColor: 'black'}}>
                        <Text>NFC Data Exchange Format Test (Android)</Text>
                        <View style={{ flexDirection: 'row', alignItems: 'center' }}>
                            <Text>http://www.</Text>
                            <TextInput
                                style={{width: 200}}
                                value={urlToWrite}
                                onChangeText={urlToWrite => this.setState({ urlToWrite })}
                            />
                        </View>

                        <TouchableOpacity 
                            style={{ marginTop: 20, borderWidth: 1, borderColor: 'blue', padding: 10 }} 
                            onPress={isWriting ? this._cancelNdefWrite : this._requestNdefWrite}>
                            <Text style={{textAlign: 'center', color: 'blue'}}>{`${isWriting ? 'Cancel' : 'Write NDEF'} (Android Only) `}</Text>
                        </TouchableOpacity>
                    </View>
_requestNdefWrite = () => {
        function strToBytes(str) {
            let result = [];
            for (let i = 0; i < str.length; i++) {
                result.push(str.charCodeAt(i));
            }
            return result;
        }

        let {isWriting, urlToWrite} = this.state;
        if (isWriting) {
            return;
        }

        console.log("urlToWrite = " + urlToWrite);
        const urlBytes = strToBytes(urlToWrite);
        const headerBytes = [0xD1, 0x01, (urlBytes.length + 1), 0x55, 0x01];
        const bytes = [...headerBytes, ...urlBytes];
        console.log("bytes");console.log(bytes)
        this.setState({isWriting: true});

        NfcManager.requestNdefWrite(bytes)
            .then(() => console.log('write completed'))
            .catch(err => console.warn(err))
            .then(() => this.setState({isWriting: false}));
    }

from react-native-nfc-manager.

whitedogg13 avatar whitedogg13 commented on August 20, 2024

Hi, sorry that I still cannot reproduce this issue, so I won't be able to fix it.

Just feel free to update any progress regarding this issue!

from react-native-nfc-manager.

whitedogg13 avatar whitedogg13 commented on August 20, 2024

Close it for now due to no further activities

from react-native-nfc-manager.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.