nfc

How to send/receive text between Android and Computer?

浪子不回头ぞ 提交于 2019-12-12 02:53:09
问题 I want to send a plain or rich text from/to Android <-> Computer, probably to clipboard but not necessarily. How can I do that? I don't want to email or create a file in order write text into it. Does the Android API allow to do that somehow? Maybe via NFC or Bluetooth? I'd like it to be wireless. 回答1: From your android device you can pass String to PC like this . try { Socket socket = new Socket(DESTINATION_ADDRESS, DESTINATION_PORT); // Exmp : Socket socket = new Socket("192.168.0.101", 80)

Android NFC function in ICS

两盒软妹~` 提交于 2019-12-12 02:45:25
问题 In Android ICS, there are 3 ways to share data by P2P. 1. enableForegroundNdefPush(existed from gingerbread) 2. setdefPushMessage 3. setNdefPushMessageCallback As I tried, in Android ICS, calling enableForegroundNdefPush pop "Tap to share" UI to beam the data if "Tap to share" setting is on. Is there any way to share data by P2P without popping "Tap to share" UI even if "Tap to share" setting is on as enableForegroundNdefPush did in Android gingerbread. Moreover, setLocalNdefMessage is

How to solve NoClassDefFoundError preconditions?

ⅰ亾dé卋堺 提交于 2019-12-11 23:24:02
问题 I create NFC reader when I run it has stopped and logcat show java.lang.NoClassDefFoundError: com.google.common.base.Precondition How to solve it? Please support me. 回答1: It sounds like you are using or modifying one of the SDK samples and need these libraries: http://code.google.com/p/guava-libraries/ 来源: https://stackoverflow.com/questions/10512739/how-to-solve-noclassdeffounderror-preconditions

android - NFC in fragments, onNewIntent isn't called after I return from another activity

一笑奈何 提交于 2019-12-11 18:25:18
问题 I have an application that uses the NFC. I have a MainActivity that extends a BaseActivity. In the BaseActivity, on the "onCreate" method, I initialize the nfc. ---- Base Activity ---- .... private void initializeNfc() { NfcManager manager = (NfcManager) getSystemService(NFC_SERVICE); nfcAdapter = manager.getDefaultAdapter(); IntentFilter filterNdef = new IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED); try { filterNdef.addDataScheme(CipherClient.nfcDataScheme()); filterNdef.addDataAuthority

How to read an NFC tag which is already attached to the device

白昼怎懂夜的黑 提交于 2019-12-11 14:36:17
问题 My requirement is to read an NFC tag which is already attached to the device. I observed the following in my application: An NFC tag is already attached to the device and NFC is off. When I then launch my Android app it will ask to turn on the NFC and, after turning on NFC, my app will read the NFC tag that was already attached to the device. An NFC tag is already attached to the device and NFC is on. When I then launch my app manually, it will not detect the NFC tag. Why is the NFC tag not

Application receiving NFC always pops up new instance in front

我的梦境 提交于 2019-12-11 13:54:03
问题 I run through the following life-cycle when starting my app through the launcher: onCreate..., onPostCreate..., onResume..., onNewIntent..., act:android.intent.action.MAIN, mNfcAdapter.disableForegroundDispatch OK. When I then tap a tag, a new instance of application seems to be launched as I run through the following life-cycle then: onPause..., onCreate..., onPostCreate..., onResume..., onNewIntent..., act:android.nfc.action.TAG_DISCOVERED, myTag.mId:048a1382bd2384) Since I try to use the

Why I'm getting IOException when making NFC tag read only

三世轮回 提交于 2019-12-11 12:12:04
问题 I'm doing my NFC writing in the AsyncTasks doInBackground() . When I write NdefRecord it works well but when I'm trying to make tag read only I'm getting IOException . Here is the code where exception occurs: if (readOnly && !ndef.canMakeReadOnly()) { throw new NdefCantMakeReadOnlyException(R.string.cant_make_read_only); } else if (readOnly) { ndef.makeReadOnly(); //IOException } This makeReadOnly works with Mifare Ultralight (MF0ICU1) tags. 回答1: Browsing through the Android 4.4.2 source (I

NFC - p2p mode scenario

南楼画角 提交于 2019-12-11 11:26:14
问题 As far as I understand with the latest Android SDK it is possible for the phone to act as a 'Tag' to be read by a NFC reader. I would like to implement the following scenario: Phone gets placed next to an NFC reader The NFC reader collects a GUID (Basically I'd like to read some data via NFC that can be used to uniquely identify the phone/owner, nothing fancy) That GUID is then pushed to a database together with a timestamp Data collected that way would be browsable via a web page. 1) Is this

making NFC Activity private without android:exported=false

只谈情不闲聊 提交于 2019-12-11 11:23:23
问题 I have an NFC activity which specifies an intent filter and data. This is something like <intent-filter> <action android:name="android.nfc.action..." /> <category android:name="android.intent.category.DEFAULT" /> <data android:host="..." android:path="..." /> </intent-filter> Now the concern here is that since I have not included android:exported="false" . it makes this activity susceptible to malicious attack from outside apps as the activity is now publicly available. The problem here is

Native DESFire APDU Framing not worked

Deadly 提交于 2019-12-11 10:53:13
问题 I'm using Galaxy A5, Android 5.0.2, SDK 21 with Android Studio 1.1.0 Android as PCD, and Mifare DESFire as PICC. Native DESFire APDU Framing didn't work, but ISO 7816-4 worked. Example: MIFARE DESFire SelectApplication with AID equal to 000000h (PICC level) Command: 90 5a 00 00 03 00 00 00 00 . Expected response: 91 00 . Currently the response is 68 00 . Document reference: AN11004.pdf (page 33) void SelectApp() { _isoDep.connect(); byte[] reqSelectApp = new byte[]{(byte) 0x90, (byte) 0x5A,