本文整理了Java中android.nfc.tech.Ndef.connect()
方法的一些代码示例,展示了Ndef.connect()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ndef.connect()
方法的具体详情如下:
包路径:android.nfc.tech.Ndef
类名称:Ndef
方法名:connect
暂无
代码示例来源:origin: commonsguy/cw-omnibus
ndef.connect();
代码示例来源:origin: commonsguy/cw-omnibus
ndef.connect();
代码示例来源:origin: RickyYu/Nfc-Android
/**
* 写数据
*
* @param ndefMessage 创建好的NDEF文本数据
* @param tag 标签
* @return
*/
public static boolean writeTag(NdefMessage ndefMessage, Tag tag) {
try {
Ndef ndef = Ndef.get(tag);
ndef.connect();
ndef.writeNdefMessage(ndefMessage);
return true;
} catch (Exception e) {
}
return false;
}
}
代码示例来源:origin: skjolber/external-nfc-api
private void ndefWrite() {
Log.d(TAG, "NDEF write");
Message message = new Message();
UriRecord record = new UriRecord();
record.setUri(Uri.parse("https://github.com/skjolber/external-nfc-api"));
message.add(record);
try {
ndef.connect();
ndef.writeNdefMessage(message.getNdefMessage());
ndef.close();
} catch (Exception e) {
Log.d(TAG, "Problem writing NDEF message", e);
}
}
代码示例来源:origin: RickyYu/Nfc-Android
ndef.connect();
代码示例来源:origin: skjolber/ndef-tools-for-android
try {
if(!ndef.isConnected()) {
ndef.connect();
代码示例来源:origin: RickyYu/Nfc-Android
ndef.connect();
代码示例来源:origin: Mobisocial/EasyNFC
Ndef ndef = Ndef.get(tag);
if (ndef != null) {
ndef.connect();
if (!ndef.isWritable()) {
Log.w(TAG, "Tag is read-only.");
代码示例来源:origin: bparmentier/WiFiKeyShare
Ndef ndef = Ndef.get(tag);
if (ndef != null) {
ndef.connect();
if (!ndef.isWritable()) {
Log.w(TAG, "Tag not writable");
代码示例来源:origin: RickyYu/Nfc-Android
/**
* 写入标签
*
* @param message
* @param tag
* @return
*/
public static boolean writeTag(NdefMessage message, Tag tag) {
int size = message.toByteArray().length;
try {
Ndef ndef = Ndef.get(tag);
if (ndef != null) {
ndef.connect();
if (!ndef.isWritable()) {
return false;
}
if (ndef.getMaxSize() < size) {
return false;
}
ndef.writeNdefMessage(message);
return true;
}
} catch (Exception e) {
}
return false;
}
}
代码示例来源:origin: skjolber/ndef-tools-for-android
Log.d(TAG, "Write formatted tag");
ndef.connect();
if (!ndef.isWritable()) {
Log.d(TAG, "Tag is not writeable");
内容来源于网络,如有侵权,请联系作者删除!