标签写在android实际运行的代码示例上

时间:2013-03-28 13:48:08

标签: android nfc

我已经就Stack Overflow关于Tag编写进行了各种讨论。但没有找到任何实用的代码示例,可以帮助我构建使用Android NFC功能在标签上编写的功能。

我正在尝试在Android Jelly Bean上构建Tag Writing功能。 但是没能写标签。

有人可以帮我提供一些示例代码或示例吗?

感谢您的分享。

2 个答案:

答案 0 :(得分:0)

查看我创建的NDEF Tools for Android项目。它包含在Android上进行阅读,书写和发送的代码。另请参阅有助于学习NDEF格式的NFC Eclipse plugin

答案 1 :(得分:0)

以下是我使用我发布的用于Android的Nfc实用程序类编写代码的操作here

    @Override
    protected void onNewIntent(Intent intent) {
        // Tag writing mode
        if (writeMode && nfcUtil.checkTagIntentMatch(intent)) {
            Tag detectedTag = nfcUtil.getTag(intent);
            try {
                Util.playSound(this);
            } catch (Exception e) { }
            nfcUtil.writeTag(movie.asNdef(), detectedTag);
        }
    }